Hi all:
I have a VB program that will not allow me to quit Word without clicking the Alert upon closing. I've used the same code in .Net and it works fine.
I have bolded the Alert lines.
Any help will be greatly appreciated.
Ron Repp
If gray hair is a sign of wisdom, then I'm a genius.
My newest novel: Wooden Warriors
I have a VB program that will not allow me to quit Word without clicking the Alert upon closing. I've used the same code in .Net and it works fine.
Code:
Public Sub MergeDoc(ByVal DocName As String, ByVal SaveName As String)
If WD.Visible = False Then WD.Visible = True
OpenDocument (DocName)
With WD
With .ActiveDocument.MailMerge
.Destination = Word.WdMailMergeDestination.wdSendToNewDocument
.Execute
End With
On Error GoTo NoFile
End With
SaveAs (SaveName)
Select Case SaveName
Case DefPath & "Letters\JuvExpired" & sM & sD & sY & ".doc"
Expired = CountPages()
InsertData "EXPIRED", "LETTER", Expired, "JuvExpired" & sM & sD & sY & ".doc"
Case DefPath & "Letters\JuvDecline" & sM & sD & sY & ".doc"
Denied = CountPages()
InsertData "DECLINED", "LETTER", Denied, "JuvDecline" & sM & sD & sY & ".doc"
Case DefPath & "Letters\JuvInvalid" & sM & sD & sY & ".doc"
Invalid = CountPages()
InsertData "INVALID", "LETTER", Invalid, "JuvInvalid" & sM & sD & sY & ".doc"
End Select
[b][i]WD.DisplayAlerts = wdAlertsNone[/i][/b]
WD.ActiveDocument.Close (False)
Exit Sub
NoFile:
WD.ActiveDocument.Close (False)
End Sub
Public Sub SaveAs(ByVal FileName As String)
WD.ActiveDocument.SaveAs (FileName)
End Sub
Public Sub QuitWord()
[b][i]WD.DisplayAlerts = wdAlertsNone[/i][/b]
On Error GoTo QuitERR
WD.ActiveDocument.Close (False)
QuitERR:
WD.Quit
Set WD = Nothing
End Sub
I have bolded the Alert lines.
Any help will be greatly appreciated.
Ron Repp
If gray hair is a sign of wisdom, then I'm a genius.
My newest novel: Wooden Warriors