New
#1
Need help with using vba macro to align graphic to top right of page
I need help with using a vba macro to align a graphic (or shape) to the top right of the page.Code:Sub alignGraphicElementToTopRightCornerOfPage() ' ' alignGraphicElementToTopRightCornerOfPage Macro ' ' Selection.ShapeRange.Align msoAlignTops, True Selection.ShapeRange.Align msoAlignRights, True End Sub
See the difference between what happens when I use the macro, and what happens when I manually do the multiple commands from the ribbon. I created the macro using the record feature.
The macro makes the item go off the page which is undesired behaviour, which is not what happened when I recorded the macro.
Why isn't it working? I recorded the macro correctly. Is there any vba code I need to change or add to it?
I'm using Microsoft Office 2007