kennyrogersjr
Board Regular
- Joined
- Apr 30, 2008
- Messages
- 100
Hey folks,
Been awhile since I've needed to consult my go-to forum for VBA questions. I found some hints stating that the code-junkies perusing Mr. E's interwebs like to go a few rounds with the other MS VBA dialects.
If someone can point out my flaw, I would appreciate it. I can't get past the "Invalid use of property" compile error on my first "si.ScaleHeight" line. See below:
Been pouring over MSDN and various forums to find my error and I just can't see what I did wrong. A second pair of eyes reviewing my code would be helpful.
Ken
Been awhile since I've needed to consult my go-to forum for VBA questions. I found some hints stating that the code-junkies perusing Mr. E's interwebs like to go a few rounds with the other MS VBA dialects.
If someone can point out my flaw, I would appreciate it. I can't get past the "Invalid use of property" compile error on my first "si.ScaleHeight" line. See below:
Code:
Sub CenterPics()
Dim si As InlineShape
Dim s As Shape
Set docAD = ActiveDocument
For Each si In docAD.Shapes
Select Case si.Type
Case msoEmbeddedOLEObject, msoLinkedOLEObject, msoOLEControlObject, msoLinkedPicture, msoPicture
si.ScaleHeight 0.89, True
si.ScaleWidth 0.89, True
si.Left = wdShapeCenter
si.Top = wdShapeCenter
si.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
si.RelativeVerticalPosition = wdRelativeVerticalPositionPage
Case Else
si.ScaleHeight 0.89, False
si.ScaleWidth 0.89, False
si.Left = wdShapeCenter
si.Top = wdShapeCenter
si.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
si.RelativeVerticalPosition = wdRelativeVerticalPositionPage
End Select
Next
For Each s In docAD.Shapes
Select Case s.Type
Case msoEmbeddedOLEObject, msoLinkedOLEObject, msoOLEControlObject, msoLinkedPicture, msoPicture
s.ScaleHeight 0.89, True
s.ScaleWidth 0.89, True
s.Left = wdShapeCenter
s.Top = wdShapeCenter
s.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
s.RelativeVerticalPosition = wdRelativeVerticalPositionPage
Case Else
s.ScaleHeight 0.89, False
s.ScaleWidth 0.89, False
s.Left = wdShapeCenter
s.Top = wdShapeCenter
s.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
s.RelativeVerticalPosition = wdRelativeVerticalPositionPage
End Select
Next
End Sub
Been pouring over MSDN and various forums to find my error and I just can't see what I did wrong. A second pair of eyes reviewing my code would be helpful.
Ken