I'm beyond the limits of my kindergarten-level VBA skills so would like to ask if anyone here can help me write a VBA script to help me work stepwise through my Word document and adjust the anchoring position of all the AutoShapes in the document.
I have a 400-page book in Microsoft Word with at least one and sometimes several marginalia (sidenote) on each page in a thin column to the left of the main body text column. These sidenotes are a concise 'pointer' to a particular point made in the body text and need to appear directly to that point's left.
Each sidenote is in its own AutoShape (within a textbox in that shape). The AutoShapes were placed by the author in an inconsistent way. Mostly they are anchored to a position on the page.
However, I need to repaginate. This will cause the body text to flow differently and I need the sidenotes to flow with it (approximately or exactly)!
So before I repaginate I want to make sure I anchor each AutoShape to the paragraph it belongs to and not to the page it is currently on.
I don't know if that can be done automatically, since I don't know how Word could deduce a purely spatial relationship between an AutoShape and a paragraph.
So I'm guessing I have to make do with a "semi-automatic" process. Something like this:
- Press a button to start VBA script
- Select next AutoShape
- Prompt for user to enter cursor in body text where anchor is to be placed
- Resume macro
- Place anchor for that AutoShape in that position
- Change vertical position paramater of AutoShape to "relative to paragraph" and "0 mm"
- (Alternative, not 0 mm but another value deduced to more accurately position AutoShape)
- Change width parameter of AutoShape to a particular fixed value 37 mm (some of them were a little inaccurately drawn)
- End cycle and go back to beginning to
- Select next AutoShape
Hope that is all understandable.
I've tried to record a VBA script to do some of this but have no idea how to build in the user prompt.
Any help much appreciated!
Craig