none
Sending Data Input into Userforms to Active Doc in 2010? RRS feed

  • Question

  • Hello.

    I have been searching the net for nearly a day trying to figure out the codes used in word 2010 VBA to transfer the info filled into a userform to specific bookmarks. I have never used VBA before, but catch on quick. Does anyone have any codes that can help me? I have bits and pieces of things that may be resourceful but so far nothing that does exactly what I am looking for. Also, when I try to run the codes I have it gives me an error stating I am not connected to the web? I don't want it to connect to the web? Why is it running this error? Ugh, please... help?

    Friday, December 9, 2011 3:38 PM

Answers

  • Hi Muse

    Assuming you copied/pasted the code snippet you show directly from your VBA project, then it's missing a line: End With

    Sub
      With...
          ...
      End With
    End Sub


    Cindy Meister, VSTO/Word MVP
    • Proposed as answer by Bruce Song Tuesday, December 20, 2011 5:07 AM
    • Marked as answer by Bruce Song Monday, December 26, 2011 3:21 AM
    Tuesday, December 13, 2011 5:37 PM
    Moderator

All replies

  • Hello.

    I have been searching the net for nearly a day trying to figure out the codes used in word 2010 VBA to transfer the info filled into a userform to specific bookmarks. I have never used VBA before, but catch on quick. Does anyone have any codes that can help me? I have bits and pieces of things that may be resourceful but so far nothing that does exactly what I am looking for. Also, when I try to run the codes I have it gives me an error stating I am not connected to the web? I don't want it to connect to the web? Why is it running this error? Ugh, please... help?


    Use

    ActiveDocument.Bookmarks("bookmarkname").Range.InsertBefore ControlName

    See the article "How to create a Userform" at:

    http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm

    and the following pages of Greg Maxey's website :

    http://gregmaxey.mvps.org/Create_and_employ_a_UserForm.htm

    http://gregmaxey.mvps.org/Populate_UserForm_ListBox.htm


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org
    Saturday, December 10, 2011 8:20 AM
  • Thank you Doug for your response. I actually have all those printed out and I've used them to the extent where I ended up with the suggested code above. =D

    The issue now is that I am receiving an error:

     

     

    I don't think what I am asking the Object to do requires the server? It doesn't make any sense by me.

    Here is the code I have:

    Private Sub cmdSend_Click()
    With ActiveDocument
        .Bookmarks("empname").Range.InsertBefore = TxtEmpName
    End Sub

    If you have any further feedback, please let me know. Thank you!

    Monday, December 12, 2011 3:23 PM
  • Hi Muse

    Assuming you copied/pasted the code snippet you show directly from your VBA project, then it's missing a line: End With

    Sub
      With...
          ...
      End With
    End Sub


    Cindy Meister, VSTO/Word MVP
    • Proposed as answer by Bruce Song Tuesday, December 20, 2011 5:07 AM
    • Marked as answer by Bruce Song Monday, December 26, 2011 3:21 AM
    Tuesday, December 13, 2011 5:37 PM
    Moderator