-
May 8th, 2018, 07:30 AM
#1
Thread Starter
New Member
[RESOLVED] Word Textbox Anchoring to Page Instead of Margin Using docx Format
Greetings,
We have a Visual Basic 6.0 application that creates Word documents. It uses a textbox to place certain header and footer content on the page and uses the Word 14.0 object library (Word 2010). We were using FileFormat:=wdFormatDocument on the SaveAs function and getting a .doc file. Everything was working fine. Then we switched to using FileFormat:=wdFormatXMLDocument in order to get a .docx format. The problem is now those textboxes appear to be anchoring themselves to the page, not the margin, so everything is off by 1". On the textboxes we are using:
.RelativeHorizontalPosition = wdRelativeHorizontalPositionMargin
but have also tried other settings without any luck.
Is anyone familiar with this and know of a work-around?
Thanks,
Jeff
-
May 15th, 2018, 11:50 AM
#2
Re: Word Textbox Anchoring to Page Instead of Margin Using docx Format
Ive not used it. Not had the need. But, just a thought, when you create your anchor, is there some object or elelment you apply it to?
If you set the left margin manually, or adjust one manually, can you see where the anchor is, or the values used to display..?
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
May 15th, 2018, 04:21 PM
#3
Re: Word Textbox Anchoring to Page Instead of Margin Using docx Format
if you have added an inline shape, i believe you have to convert it to a shape, though i have no idea why it would be different between the word document versions, if you post the full code, someone could have a look
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
May 24th, 2018, 02:49 PM
#4
Thread Starter
New Member
Re: Word Textbox Anchoring to Page Instead of Margin Using docx Format
Thank you for your responses. For some reason I didn't get notified that there were responses to my question and just now saw them for the first time.
I ended up putting in some "padding" to the offset of the textboxes in order to get them in the right location. It seems to be working fine.
Thanks again, much appreciated,
Jeff
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|