Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-04-2014, 02:49 PM
Deltaj Deltaj is offline anchor addtextbox to new page Windows 7 64bit anchor addtextbox to new page Office 2013
Novice
anchor addtextbox to new page
 
Join Date: Nov 2014
Posts: 5
Deltaj is on a distinguished road
Default anchor addtextbox to new page

Problem: Coordinates for Textbox do not update when the focus moves to the 2nd and subsequent pages.



The documentation on AddTextbox does mention use of an Anchor, but with no example.

Previous use of an Anchor for AddPicture kindly devised in a reply by macropod on 3 Dec 2014 gave me this code which works fine to locate a picture on the correct page; the code also adds a pagebreak from the previous page.
Code:
Dim Rng As Range
With ActiveDocument
  Set Rng = .Range
  With Rng
    .Collapse direction:=wdCollapseEnd
    .InsertBreak Type:=wdPageBreak
    .Collapse direction:=wdCollapseEnd
  End With
  .Shapes.AddPicture LinkToFile:=False, Anchor:=Rng, _
    FileName:="C:\somefilename.bmp",  _
    SaveWithDocument:=True, Left:=300, Top:=1, Width:=100, Height:=100
End With
So from the above code where Anchor:= .Rng I hoped to use this in:

ActiveDocument.Shapes.AddTextbox(msoTextOrientatio nHorizontal, 74, 92, 282, 24, xxxxxx) - this is what the "Help" tells me is how to anchor the AddTextbox.

xxxxx is the anchor, but I have failed to find a syntax that works for this instruction.

The VBA "Help" could be a lot better on things like this so I am very thankful for this forum.

So how do you set up an Anchor for Textboxes please?





Last edited by macropod; 12-05-2014 at 01:52 AM. Reason: Added code tags & formatting
Reply With Quote
  #2  
Old 12-05-2014, 01:56 AM
macropod's Avatar
macropod macropod is offline anchor addtextbox to new page Windows 7 64bit anchor addtextbox to new page Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The code is essentially the same:
Code:
Dim Rng As Range
With ActiveDocument
  Set Rng = .Range
  With Rng
    .Collapse direction:=wdCollapseEnd
    .InsertBreak Type:=wdPageBreak
    .Collapse direction:=wdCollapseEnd
  End With
  .Shapes.AddTextbox Orientation:=msoTextOrientationHorizontal, _
    Left:=74, Top:=92, Width:=282, Height:=24, Anchor:=Rng
End With
PS: When posting code, please use the code tags, indicated by the # button on the posting menu.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
addtextbox, anchor, newpage



Similar Threads
Thread Thread Starter Forum Replies Last Post
anchor addtextbox to new page Link or Anchor Drawings to Text RayLab OneNote 6 01-07-2015 12:30 PM
anchor addtextbox to new page anchor a frame so it wont move. blockie Drawing and Graphics 2 08-17-2014 07:06 AM
Page layout: skipping one page for new elements added at end of a page MarcA Word 3 09-30-2013 02:58 PM
2 page document printing problem, text from page 1 in layout of page 2 when printed laurawether45 Word 1 08-02-2012 07:03 AM
Text boxes don't anchor properly in PPT '08 noni PowerPoint 0 11-13-2011 09:16 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:17 AM.


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