PDA

View Full Version : MS WORD 2013 VBA UserForm Error Help



blessing786
08-13-2016, 06:12 PM
Hi

Please accept my apologies if I have not posted this in the right place but I am new so do bare with me.

I am also fairly new to VBA.

I am looking for some help after running into an issue. I am basically have a document which I am trying to populate with a UserForm. The idea is that I fill out the userform and the document in the back gets filled out, Currently I am doing this via bookmarks. The issue I am having is when I type in my userform the field with the bookmarks starts to input random characters. For instance if I type "Hello how are you" in a texbox in the userform which is linked to a table in the word doucment via a bookmark, The field is populated with gibberish letters like so "hello are youhello are youihello are youi hello are youihello are youhello are yohello are yhello are yuhello are yuohello are yuhello are yhello are hello arehello arhello ahello hellohellhelheh" All of this by typing those simple words, What am i doing wrong?

I can paste the code here if you like. The long time idea is that I can use this userform feature to fill out forms with an option at the end to save it as PDF or word document so it can be emailed or printed.

blessing786
08-13-2016, 06:14 PM
Private Sub CommandButton1_Click()
'Advance by one page
iPageNo = MultiPage1.Value + 1
MultiPage1.Pages(iPageNo).Visible = True
MultiPage1.Value = iPageNo
End Sub


Private Sub CommandButton2_Click()
'Advance by one page
iPageNo = MultiPage1.Value + 1
MultiPage1.Pages(iPageNo).Visible = True
MultiPage1.Value = iPageNo
End Sub


Private Sub CommandButton3_Click()
'Go back by one page
iPageNo = MultiPage1.Value - 1
MultiPage1.Pages(iPageNo).Visible = True
MultiPage1.Value = iPageNo
End Sub


Private Sub TextBox1_Change()
With ActiveDocument
.Bookmarks("Crimereference").Range _
.InsertAfter TextBox1


End With


End Sub