D
Doctorjones_md
I have the following VBA code with opens a Word Template (.dot extension)
from Excel:
1. CommandButton1 code on worksheet --
Private Sub CommandButton1_Click()
SQLRollup
DeleteBlankRows
RollupToSQLServer1
InsertTrackingSpecificData
frmClients.Show
End Sub
2. Code on frmClients
Private Sub cmdProposal_Click()
frmOrders.Show
frmClients.Hide
End Sub
3. Code on frmOrders
Private Sub cmdManaged_Click()
'opens a new Word Template
Dim wordApp As Word.Application
Dim wordDot As Word.Template
Set wordApp = New Word.Application
On Error Resume Next
With wordApp
.Visible = True
Set wordDot =
..Documents.Open("\\Network\Products\Clients\Orders.dot", , False)
End With
Unload Me
End Sub
==============================================
The problem I'm having is that the code in item#3 opens the template without
forcing a new Document1 -- therefore, the template get over-written by any
modifications made while in use. What's curious is that when I navigate to
the Order.dot file (outside of Excel) and CLICK on it, a Document1 is
created.
How can I modify the code to do (from within Excel) what simply openning the
file from Explorer does?
Thanks in advance for any and all suggestions/recommendations.
from Excel:
1. CommandButton1 code on worksheet --
Private Sub CommandButton1_Click()
SQLRollup
DeleteBlankRows
RollupToSQLServer1
InsertTrackingSpecificData
frmClients.Show
End Sub
2. Code on frmClients
Private Sub cmdProposal_Click()
frmOrders.Show
frmClients.Hide
End Sub
3. Code on frmOrders
Private Sub cmdManaged_Click()
'opens a new Word Template
Dim wordApp As Word.Application
Dim wordDot As Word.Template
Set wordApp = New Word.Application
On Error Resume Next
With wordApp
.Visible = True
Set wordDot =
..Documents.Open("\\Network\Products\Clients\Orders.dot", , False)
End With
Unload Me
End Sub
==============================================
The problem I'm having is that the code in item#3 opens the template without
forcing a new Document1 -- therefore, the template get over-written by any
modifications made while in use. What's curious is that when I navigate to
the Order.dot file (outside of Excel) and CLICK on it, a Document1 is
created.
How can I modify the code to do (from within Excel) what simply openning the
file from Explorer does?
Thanks in advance for any and all suggestions/recommendations.