Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-29-2018, 01:32 PM
kkkwj kkkwj is offline what are the rules for how to anchor a shape? Windows 10 what are the rules for how to anchor a shape? Office 2016
Novice
what are the rules for how to anchor a shape?
 
Join Date: Nov 2017
Posts: 6
kkkwj is on a distinguished road
Default what are the rules for how to anchor a shape?


I'm trying to generate a series of pages in Word and add some shapes to each page. The code below works, but I don't understand why (or how) the shape-anchoring works.

The shapes get anchored to the new paragraph that I insert. If I don't insert that paragraph, all three sets of shapes end up stacked on each other on the last page in the series. Why don't the shapes anchor themselves to the paragraphs that I create when I insert the "New page" text? Why is a second new paragraph required? Thank you.

Code:
    npages = 3
    For i = 1 To 3
      If (i <= npages) Then
         Selection.Text = "New Page " + i
         Selection.Collapse wdDirection:=wdCollapseEnd
         
         ' the shapes get anchored to this paragraph below, not to the text above. Why?
         ' If I take out the paragraph, all 3 sets of shapes stack on each other,
         ' on the very last page of the set. Why?
         Selection.InsertParagraph
         'set shape = doc.shapes.addshape(rectangle,left,top,wdith,height)
         
         ' don't generate a new page after the last page of the series
         If (i < npages) Then
            Selection.InsertBreak Type:=wdPageBreak
         End If
      End If
    Next
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word2010 Text Anchor - How To Do It? bluenite Word 3 05-07-2018 05:04 AM
How to change size / shape of a shape in a stencil tomgoodell Visio 1 06-30-2016 04:40 AM
what are the rules for how to anchor a shape? anchor addtextbox to new page Deltaj Word VBA 1 12-05-2014 01:56 AM
Text boxes don't anchor properly in PPT '08 noni PowerPoint 0 11-13-2011 09:16 AM
Question about Tools>Rules and Alerts>E-mail Rules RichGuard Outlook 0 09-02-2010 05:19 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:00 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft