![]() |
#1
|
|||
|
|||
![]()
Hi, my first post here, so please go easy on me
![]() I have a Word document using two separate userforms to fill in information into bookmarks in the main doc. Everything is working fine, the bookmarks are updated and I can re-open the userforms as long as the main doc is not saved and closed. The challenge is that if I close the main doc, and opens it again, I have to fill in all the textboxes in the userform again. Is there a way to make the userform automatically read the bookmarks upon opening? Here is what I have done so far: When the doc is opened I have the following code: Private Sub Document_Open() UserForm1.Show UserForm2.Show End Sub I can also open the userforms by two command buttons: Private Sub ShowUserForm1_Click() UserForm1.Show End Sub Private Sub ShowUserForm2_Click() UserForm2.Show End Sub Then, the UserForm1 uses the following code to insert data to a bookmark: Private Sub OKbutton_Click() Dim BMClientCompanyName As Range Set BMClientCompanyName = ActiveDocument.Bookmarks("NameOfClientHeader").Ran ge BMClientCompanyName.Text = Me.TextBoxClientCompanyName.Value ActiveDocument.Bookmarks.Add "NameOfClientHeader", BMClientCompanyName Me.Repaint UserForm1.Hide Any support will be highly appreciated! |
Tags |
bookmarks, populate, userform |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
jrooney7 | Word VBA | 2 | 04-14-2019 06:30 PM |
Dynamic Userform multiselect listbox populate | trevorc | Excel Programming | 1 | 12-03-2018 02:49 PM |
Userform calls other userform, then populate worksheet | Lehoi | Excel Programming | 0 | 02-03-2016 02:58 PM |
Trying to populate Word bookmarks with excel UserForm | smd1112 | Excel Programming | 7 | 09-03-2014 09:42 PM |
Word doc bug when closing from userform command button click macro | Joe Patrick | Word | 1 | 07-05-2011 08:53 PM |