#1
|
|||
|
|||
VBA: how can I know the position on a document?
Suppose I want to add a textbox on a Word Document. Is there any ruler that tells me the exact position where I want to add the textbox? And what's the unit of the following statement?
Code:
Set newTextbox = docNew.Shapes.AddTextbox _ (Orientation:=msoTextOrientationHorizontal, _ Left:=100, Top:=100, Width:=300, Height:=200) |
#2
|
||||
|
||||
Have you looked at Word's help file for the 'AddTextbox' method?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Yes. I've read the addTextbox to a canvas method. But this is not answered in the help document. How can I know the points of the position I want? Cos the ruler does not show point.
|
#4
|
||||
|
||||
If you want the ruler to display in points, go to Word Options|Advanced > Display and choose 'Points' from the 'Show measurements in units of' dropdown. However, this shouldn't be necessary as you can use Word's CentimetersToPoints function so that you can work in centimeters. For example, for the textbox you might use:
.Top = CentimetersToPoints(2) and Word will interptret this as a 2cm offset. All very simple. There is also an InchesToPoints function.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
fix position for a segment in a doc | tai | Word | 3 | 10-20-2011 01:04 PM |
Pictures Not Staying In Position | BrazzellMarketing | Word | 3 | 10-06-2011 06:54 AM |
character spacing position disabled | fogharty | Word | 2 | 07-27-2011 01:26 PM |
Retrieve position of Cursor - x & y positions | SDondeti | PowerPoint | 0 | 05-19-2011 11:39 AM |
Problem with watermark position in msword | Nandu4u | Word | 0 | 12-29-2009 09:17 AM |