Excel/Get TypeName


Good day Jan,

I'm faily nocice using Shapes properties.
Got some code here and there and was able to obtained what I wanted.
However, I was not able to obtain the Typename in Text.
.Type is giving me a number only.
Some other code that I used previously provided that info OK (used For each obj in wksht.Shapes - see last line code)

Hopefully, it is clear enough...
Any other how?

... code removed
For Each wksht In Worksheets
For Each sShapes In wksht.Shapes
 If sShapes.Type <> 4 Then   'Do not want "Comment"
  With sShapes
   lLoop = lLoop + 1          'Incremente
   LogShapes.Cells(lLoop + 1, 1) = .Name
   LogShapes.Cells(lLoop + 1, 2) = .Type     
   LogShapes.Cells(lLoop + 1, 10) = .OLEFormat.Object.Name
  'LogShapes.Cells(lLoop + 1, 12) = TypeName(obj.OLEFormat.Object)

Hi Daniel,

Perhaps like so?

   For Each wksht In Worksheets
       For Each sShapes In wksht.Shapes
         If sShapes.Type <> 4 Then   'Do not want "Comment"
         With sShapes
         lLoop = lLoop + 1          'Incremente
         logshapes.Cells(lLoop, 1) = .Name
         logshapes.Cells(lLoop, 2) = .Type
         logshapes.Cells(lLoop, 3) = .OLEFormat.Object.Name
         logshapes.Cells(lLoop, 4) = TypeName(.OLEFormat.Object)
         End With
         End If

About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Jan Karel Pieterse


Excel and Excel/VBA questions


Excel MVP

Self employed Excel developer

Bachelor in Chemical Engineering

Awards and Honors
Microsoft MVP award since 2002

Past/Present Clients
Shell, Fortis bank, ABN-AMRO bank, Morgan Stanley, ...

©2017 About.com. All rights reserved.