Hello!
This is part of a code which cycles through each shape on a sheet and displays a list of info about those shapes.
My home computer uses Excel 2010 and the code compiles and runs fine. When I run it from Excel 2003, it gives a "Method or data member not found." error for these: shp.Shadow.Blur, Size, and Style.
I can't find anything which talks about these or which version of XL they were added.
Anyone have any background info on these?
And Is this the right syntax for the version code?
Shape codeIf Val(Application.Version) >= 12 Then ...code for 2007/2010 stuff end if
Respectfully,Private Sub m_DisplayDetails(Shp As Shape, CommentAddress As String) Dim lngIndex As Long On Error Resume Next ListBox2.Clear lngIndex = 0 ListBox2.AddItem "Shadow.Blur" ListBox2.List(lngIndex, 1) = ShapeRange.Shadow.Blur lngIndex = lngIndex + 1 ListBox2.AddItem "Shadow.Size" ListBox2.List(lngIndex, 1) = Shp.Shadow.Size lngIndex = lngIndex + 1 ListBox2.AddItem "Shadow.Style" ListBox2.List(lngIndex, 1) = Shp.Shadow.Style lngIndex = lngIndex + 1 End Sub
Lost
They were added in 2007.
romperstomper,
Thanks!
I tried to fix the code, but it still won't compile (same error: Method/Member not found.).
Any ideas to fix this?
Respectfully,'end 2003 code 'start 2007 code If Val(Application.Version) >= 12 Then ListBox2.AddItem "Shadow.Blur" ListBox2.List(lngIndex, 1) = Shp.Shadow.Blur lngIndex = lngIndex + 1 ListBox2.AddItem "Shadow.Size" ListBox2.List(lngIndex, 1) = Shp.Shadow.Size lngIndex = lngIndex + 1 ListBox2.AddItem "Shadow.Style" ListBox2.List(lngIndex, 1) = Shp.Shadow.Style lngIndex = lngIndex + 1 End If ' end 2007 code 'back to 2003 code
Lost
It won't compile in 2003 as the method doesn't exist (the application check only takes place at runtime).
You need to put any 2007 specific code into its own module and only call that after checking the version. The code will still not compile in 2003 if you actively try to compile the project, but it will work at runtime since the other module won't get called at all and therefore the compiler will ignore it.
You could also declare the shp object as Object rather than Shape.
Note you will lose intellisense if you do that.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks