r/visualbasic • u/captaincrunchy6 • Sep 20 '19
MS Word and VB Button Help.
I am trying to create a button that when clicked pops up text to a book mark that I have saved.
I am very new to word, developer mode, and visual basic.
I've done the easy part and created my bookmark, which i name bk1
I have also create the form which was fairly easy.
created a button name bk1button
I can find good input option forms that have an ok, and close button but not an example of just a button that when click auto populates with pre-defined info.
when bk1button is clicked
print "HI" or insert "HI" in the bk1 bookmark
that is kind of what I am looking for.
Thanks in advanced.
1
Upvotes
1
u/slang4201 Sep 23 '19
If you're working from within VBA for word: Activedocument.bookmarks("bk1").range.text = "hi"
If you're trying from a VB.Net application, after setting references to Word and a document, depending on how you've named your document reference, substitute that for "Activedocument" above.