View Single Post
 
Old 04-03-2018, 06:54 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Simply change:
Code:
    If ActiveDocument.FullName = "" Then
        MsgBox "activedocument not saved, exiting"
        Exit Sub
    Else
        If MsgBox("Save Document?", vbYesNo, "Error") <> vbYes Then Exit Sub
    End If
    strAtt = ActiveDocument.FullName
to:
Code:
    With ActiveDocument
      If .FullName = "" Then
        MsgBox "activedocument not saved, exiting"
        Exit Sub
      ElseIf .Saved = False Then
        If MsgBox("Save Document?", vbYesNo, "Error") <> vbYes Then Exit Sub
        .Save
      End If
      strAtt = Split(.FullName, ".doc")(0) & ".pdf"
      .SaveAs FileName:=strAtt, FileFormat:=wdFormatPDF, AddToRecentFiles:=False
    End With
(I've added a couple of minor enhancements)

PS: When posting code, please use the code tags, indicated by the # button on the posting menu. Without them, your code loses much of whatever structure it had.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote