bryVA
06-10-2009, 11:00 AM
Hello all,
I am trying to write a macro that will check a sheet called "Bookmark_Map" and place information in a word bookmark based on the cell values. Column A has the bookmark name and Column B has what should be inserted into the bookmark (this maybe a textbox value from a userform or a specific statement). There is a variable amount of bookmarks so how would I code this so when I need to add new bookmarks all I have to do is add them to the sheet instead of in the code.
Right now I have the following code but this doesn't check the sheet.
With oDoc
.Bookmarks("BM_1").Range.Text = ComboBox1.Value
.Bookmarks("BM_2").Range.Text = TextBox1.Value
.Bookmarks("BM_3").Range.Text = TextBox4.Value & ", " & TextBox2 & " " & TextBox3
.Bookmarks("BM_4").Range.Text = Format(Now(), "MMMM D, YYYY")
.Bookmarks("BM_5").Range.Text = "This is done."
.Bookmarks("BM_6").Range.Text = "Please check with me"
.Bookmarks("BM_7").Range.Text = "Don't do that any more"
.Bookmarks("BM_8").Range.Text = TextBox8.Value
End with
So something that say insert Combobox1 (Which is in Range("B3")) in the bookmark that is in Range("A3").
I hope this makes sense.
I am trying to write a macro that will check a sheet called "Bookmark_Map" and place information in a word bookmark based on the cell values. Column A has the bookmark name and Column B has what should be inserted into the bookmark (this maybe a textbox value from a userform or a specific statement). There is a variable amount of bookmarks so how would I code this so when I need to add new bookmarks all I have to do is add them to the sheet instead of in the code.
Right now I have the following code but this doesn't check the sheet.
With oDoc
.Bookmarks("BM_1").Range.Text = ComboBox1.Value
.Bookmarks("BM_2").Range.Text = TextBox1.Value
.Bookmarks("BM_3").Range.Text = TextBox4.Value & ", " & TextBox2 & " " & TextBox3
.Bookmarks("BM_4").Range.Text = Format(Now(), "MMMM D, YYYY")
.Bookmarks("BM_5").Range.Text = "This is done."
.Bookmarks("BM_6").Range.Text = "Please check with me"
.Bookmarks("BM_7").Range.Text = "Don't do that any more"
.Bookmarks("BM_8").Range.Text = TextBox8.Value
End with
So something that say insert Combobox1 (Which is in Range("B3")) in the bookmark that is in Range("A3").
I hope this makes sense.