J
Jeffery B Paarsa
After displaying Userform and extracting necessary fields from the user thru
Userform by double clicking on a templete X.dot following are the VBA code
that will be executed:
Private Sub CMDPrint_Click()
' some codes.....
With ActiveDocument
.Unprotect
ActiveDocument.Fields.Update
.Protect wdAllowOnlyFormFields
NPPkg.Hide
' .PrintOut
End With
openMedHistory ' This will open a new document using a new template...
see next few lines.
End Sub
Sub openMedHistory()
Word.Documents.Add Template:="G:\ZZZdoc\(ALL)MRPMedHist.dot", Visible:=False
With ActiveDocument
.Unprotect
.Bookmarks("PFName").Range _
.InsertBefore PFName
.Bookmarks("PFName").Range.Font.Color = wdColorRed
.Bookmarks("PLName").Range _
.InsertBefore PLName
.Bookmarks("PLName").Range.Font.Color = wdColorRed
ActiveDocument.Fields.Update
.Protect wdAllowOnlyFormFields
' .PrintOut
End With
End Sub
--
When I execute "openMedHistory" and the line
Word.Documents.Add Template:="G:\ZZZdoc\(ALL)MRPMedHist.dot", Visible:=False
will be executed it displays the UserForms for this newly added document.
How can I suppress this macro for the newly added Documents from being
invoked/executed? Or basically I don't want the the UserForm for this newly
added document to be displayed. Anybody can help how can I suppress this
macro?
Jeff B Paarsa
Userform by double clicking on a templete X.dot following are the VBA code
that will be executed:
Private Sub CMDPrint_Click()
' some codes.....
With ActiveDocument
.Unprotect
ActiveDocument.Fields.Update
.Protect wdAllowOnlyFormFields
NPPkg.Hide
' .PrintOut
End With
openMedHistory ' This will open a new document using a new template...
see next few lines.
End Sub
Sub openMedHistory()
Word.Documents.Add Template:="G:\ZZZdoc\(ALL)MRPMedHist.dot", Visible:=False
With ActiveDocument
.Unprotect
.Bookmarks("PFName").Range _
.InsertBefore PFName
.Bookmarks("PFName").Range.Font.Color = wdColorRed
.Bookmarks("PLName").Range _
.InsertBefore PLName
.Bookmarks("PLName").Range.Font.Color = wdColorRed
ActiveDocument.Fields.Update
.Protect wdAllowOnlyFormFields
' .PrintOut
End With
End Sub
--
When I execute "openMedHistory" and the line
Word.Documents.Add Template:="G:\ZZZdoc\(ALL)MRPMedHist.dot", Visible:=False
will be executed it displays the UserForms for this newly added document.
How can I suppress this macro for the newly added Documents from being
invoked/executed? Or basically I don't want the the UserForm for this newly
added document to be displayed. Anybody can help how can I suppress this
macro?
Jeff B Paarsa