I'm sitting here getting a bit frustrated, as i usually do, when i'm sitting with this codes that doesnt work for me.
The pop up loads, but i get an error message, as attached images tells.
Private Sub CommandButton1_Click()
With ActiveDocument
.Bookmarks("bmKursdato").Range ("TextBox1")
.InsertBefore TextBox1
.Bookmarks("bmKursklokke").Range ("TextBox2")
.InsertBefore TextBox2
.Bookmarks("bmTamed").Range ("TextBox3")
.InsertBefore TextBox3
End With
UserForm1.hide
End Sub
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
Ok, thanks. That solves the issue for my first textfield that i want to fill, but not the next two
Highlightened and marked bm2 and bm3
Private Sub CommandButton1_Click()
With ActiveDocument.Bookmarks("bmKursdato").Range.Fields(1).Result.Text = TextBox1
.Bookmarks("bmKurstid").Range.Fields(2).Result.Text = TextBox2
.Bookmarks("bmTamed").Range.Fields(3).Result.Text = TextBox3
End With
UserForm1.hide
End Sub
they should all be fields(1)
only one field to each bookmark i think
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
With ActiveDocument
.Bookmarks("bmKursdato").Range.Text = Me.TextBox1.Value
.Bookmarks("bmKurstid").Range.Text = Me.TextBox2.Value
.Bookmarks("bmTamed").Range.Text = Me.TextBox3.Value
End With