Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-03-2022, 11:51 PM
pfigen@gmail.com pfigen@gmail.com is offline How can I re-populate my userform after closing the document? Windows 10 How can I re-populate my userform after closing the document? Office 2021
Novice
How can I re-populate my userform after closing the document?
 
Join Date: May 2022
Posts: 2
pfigen@gmail.com is on a distinguished road
Default How can I re-populate my userform after closing the document?

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!
Reply With Quote
 

Tags
bookmarks, populate, userform



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I re-populate my userform after closing the document? How to populate a userform combobox from a table in the same document 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

Other Forums: Access Forums

All times are GMT -7. The time now is 07:16 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft