View Single Post
 
Old 12-19-2018, 08:13 PM
Yong Xiang Yong Xiang is offline Windows 7 32bit Office 2016
Novice
 
Join Date: Dec 2018
Posts: 9
Yong Xiang is on a distinguished road
Default

What I'm doing is when I open a new word document, I insert a template which I bookmarked using the code below and it works. Only the First template works but when I open the other few templates to reference from the First template it won't work

Basically, I want to link all dates, location, address to be the same in every page of a few different templates.


Userform Code:

PHP Code:
Private Sub CancelBut_Click()
QPMTesting.Hide

'Close the Userform

End Sub


Private Sub OKbut_Click()
    Dim Address As Range
    Dim Location As Range
    Dim HT_Type As Range
    Dim Time As Range
    Dim Weather As Range
    Dim TestDate As Range
    
'
Declaration
    
    Set Address 
ActiveDocument.Bookmarks("Customer").Range
    Set Location 
ActiveDocument.Bookmarks("HT_Location").Range
    Set HT_Type 
ActiveDocument.Bookmarks("HT_Type").Range
    Set Time 
ActiveDocument.Bookmarks("HT_Install_Date").Range
    Set Weather 
ActiveDocument.Bookmarks("Weather").Range
    Set TestDate 
ActiveDocument.Bookmarks("Date").Range

'Set declaration as an active bookmark

    Address.Text = Me.TextBox1.Text
    Location.Text = Me.TextBox2.Text
    HT_Type.Text = Me.TextBox3.Text
    Time.Text = Me.TextBox4.Value
    Weather.Text = Me.TextBox5.Text
    TestDate.Text = Me.TextBox6.Value
    
'
Set the text to be text or value
    
    Address
.Font.AllCaps True
    Location
.Font.AllCaps True
    HT_Type
.Font.AllCaps True
    Weather
.Font.AllCaps True

'Set Caps for all

    Me.Repaint

'
Refresh

    QPMTesting
.Hide

'Close the Userform
    
End Sub


Private Sub UserForm_Click()

End Sub 
Document Code:
PHP Code:
Private Sub Document_Open()
    
QPMTesting.Show
End Sub 
Reply With Quote