Results 1 to 3 of 3

Thread: [RESOLVED] Info From User Form to Header

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2010
    Posts
    1

    Resolved [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.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Info From User Form to Header

    VBA question moved to Office Development

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Info From User Form to Header

    try something like
    vb Code:
    1. With ActiveDocument
    2.     .Bookmarks("ABTTitle").Range.InsertBefore ABTTitle
    3.     .Bookmarks("ABTRevision").Range.InsertBefore ABTRevision
    4.     .Bookmarks("ABTNumber").Range.InsertBefore ABTNumber
    5.     .sections(1).headers(1).range.text = textbox3.text
    6. 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
  •  



Click Here to Expand Forum to Full Width