|
-
Mar 16th, 2010, 10:42 AM
#1
Thread Starter
New Member
[RESOLVED] Info From User Form to Header
First let me say that I wouldn't even call myself a beginner. I am finding my way by following coding examples from many different sources.
Is it possible to transfer the information from a user form to the body of the document and to headers?
I have tried it using bookmarks in the headers and also by using a combination of bookmarks and headers. Neither works.
As an example, here is the code I used when trying to use bookmarks:
Code:
Private Sub CommandButton1_Click()
With ActiveDocument
.Bookmarks("ABTTitle").Range.InsertBefore ABTTitle
.Bookmarks("ABTRevision").Range.InsertBefore ABTRevision
.Bookmarks("ABTNumber").Range.InsertBefore ABTNumber
End With
UserForm1.Hide
End Sub
Private Sub UserForm_Click()
End Sub
Thank you for any help you can give me.
-
Mar 16th, 2010, 10:44 AM
#2
Re: Info From User Form to Header
VBA question moved to Office Development
-
Mar 16th, 2010, 03:05 PM
#3
Re: Info From User Form to Header
try something like
vb Code:
With ActiveDocument .Bookmarks("ABTTitle").Range.InsertBefore ABTTitle .Bookmarks("ABTRevision").Range.InsertBefore ABTRevision .Bookmarks("ABTNumber").Range.InsertBefore ABTNumber .sections(1).headers(1).range.text = textbox3.text End With
not tested, there are 3 headers in each section of the document
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
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
|