F
Frank Tolstyka
I have a document that has VBA code attached to the Document_Open event.
Every once in a while this code will not execute. I have checked the macro
security when this happens and it is set at low. The code is included. The
document name is AIC1.doc.
Private Sub Document_Open()
Dim MyMerge As MailMerge
Dim DocName
DocName = ActiveDocument.Name
If UCase(Left(DocName, 3)) = "TMP" Then Exit Sub
Application.ActiveWindow.WindowState = wdWindowStateMinimize
Set MyMerge = ActiveDocument.MailMerge
If MyMerge.State = wdMainAndDataSource Then
MyMerge.Destination = wdSendToNewDocument
MyMerge.Execute
ActiveDocument.PrintOut Copies:=1, Background:=False
ActiveDocument.Close Savechanges:=wdDoNotSaveChanges
End If
Application.Quit Savechanges:=wdDoNotSaveChanges
End Sub
Thank you,
Frank
Every once in a while this code will not execute. I have checked the macro
security when this happens and it is set at low. The code is included. The
document name is AIC1.doc.
Private Sub Document_Open()
Dim MyMerge As MailMerge
Dim DocName
DocName = ActiveDocument.Name
If UCase(Left(DocName, 3)) = "TMP" Then Exit Sub
Application.ActiveWindow.WindowState = wdWindowStateMinimize
Set MyMerge = ActiveDocument.MailMerge
If MyMerge.State = wdMainAndDataSource Then
MyMerge.Destination = wdSendToNewDocument
MyMerge.Execute
ActiveDocument.PrintOut Copies:=1, Background:=False
ActiveDocument.Close Savechanges:=wdDoNotSaveChanges
End If
Application.Quit Savechanges:=wdDoNotSaveChanges
End Sub
Thank you,
Frank