closing word application

B

bryan

I have a template that has a macro to save the document. The macro is on the
toolbar.
The document saves and closes per command but, the application.quit does not
close word.
What am I missing?
Here is my code:

Sub ir()
'
'
Dim strpol, strco, strprfx, strpolz
strpol = ActiveDocument.FormFields("Text23").Result
strco = Mid(strpol, 1, 2)
strprfx = Mid(strpol, 4, 4)

MsgBox strco
MsgBox strprfx
If Mid(strprfx, 4, 1) <> " " Then
strprfx = Mid(strprfx, 1, 3) + " "
strpolz = Mid(strpol, 7, 9)
Else
strpolz = Mid(strpol, 8, 9)
End If

MsgBox strpolz
MsgBox Len(strpolz)
If Len(strpolz) = 9 Then
If Mid(strpolz, 1, 2) = "00" Then
strpolz = Mid(strpolz, 3, 7)
End If
End If

MsgBox strpolz
'newname = "u:\PLUW_" + strpol + "_" + "19040_" + "ENDT" +
"________________" + "C_Z.doc"
newname = "u:\PLUW_" + strco + " " + strprfx + strpolz + "_" + "19040_" +
"ENDT" + "________________" + "C_Z.doc"

ActiveDocument.SaveAs FileName:=newname, FileFormat:= _
wdFormatDocument, LockComments:=False, Password:="",
AddToRecentFiles:= _
True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:= _
False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
ActiveDocument.Close
Application.Quit

End Sub
 
R

Russ

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top