Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 05-04-2015, 03:21 AM
rogelinepaula rogelinepaula is offline Build an Automatic Document Template for Word Windows 8 Build an Automatic Document Template for Word Office 2013
Novice
Build an Automatic Document Template for Word
 
Join Date: May 2015
Posts: 22
rogelinepaula is on a distinguished road
Default

Quote:
Originally Posted by gmayor View Post
You only neeed 1 userform, with several fields. For a relatively simple description, see http://www.gmayor.com/Userform.htm That example uses docvariables and their associated fields rather than bookmarks, but if you want to fill bookmarks instead see the FillBM function at http://www.gmayor.com/word_vba_examples.htm
Thank you, gmayor!

I have seen a YouTube tutorial and I basically followed everything. I got the UserForm that I want once you open the document but for some reason the "Client" field which I have bookmarked in the document isn't being populated by whatever it is that I am typing in the userform under the Client field.

Here's the code that I've been using:
Quote:
Private Sub CommandButton1_Click()
Dim RepTitle As Range
Set RepTitle = ActiveDocument.Bookmarks("RepTitle").Range
RepTitle.Text = Me.TextBox1.Value
Dim ReportDate As Range
Set ReportDate = ActiveDocument.Bookmarks("ReportDate").Range
ReportDate.Text = Me.TextBox2.Value
Dim Client As Range
Set Client = ActiveDocument.Bookmarks("Client").Range
Client.Text = Me.TextBox3.Value
Dim ContactName As Range
Set ContactName = ActiveDocument.Bookmarks("ContactName").Range
ContactName.Text = Me.TextBox4.Value
Dim ContactAdd As Range
Set ContactAdd = ActiveDocument.Bookmarks("ContactAdd").Range
ContactAdd.Text = Me.TextBox5.Value
Dim DivInCharge As Range
Set DivInCharge = ActiveDocument.Bookmarks("DivInCharge").Range
DivInCharge.Text = Me.TextBox6.Value
Me.Repaint
UserForm1.Hide


End Sub
I am using Word 2013. Should that be an issue re bookmarks? And also, how do I make the userform disappear as soon as I hit the "OK" button?


Thank you for all the help!
Reply With Quote
 

Tags
template, userform, vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Build an Automatic Document Template for Word VBA using Building Blocks to build document kintap Word VBA 2 07-11-2014 10:56 AM
Create a Form to Build a Document Wordsquirrel Word VBA 7 05-16-2014 10:33 AM
Build an Automatic Document Template for Word One document build from subfiles duckman Word 3 03-04-2014 10:12 AM
Build an Automatic Document Template for Word Automatic update of links in template - closing attached template without saving stefaan Word 2 11-02-2013 07:46 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:51 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