View Single Post
 
Old 05-06-2014, 04:23 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit 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

If this is an ActiveX command button, you could pass the processing off to a second macro that handles the PDF creation & emailing. As part of that process, it could delete the command button, then restore it again (via Application.Undo) after the PDF has been created.

PS: When posting code, please use the code tags. They're on the 'Go Advanced' tab at the bottom of this screen.
PPS: You could reduce:
Code:
         ActiveDocument.ExportAsFixedFormat OutputFileName:=PDFname, _
          ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False, _
          OptimizeFor:=wdExportOptimizeForPrint, Range:=wdExportAllDocument, _
          Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
          CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
          BitmapMissingFonts:=True, UseISO19005_1:=False
to:
Code:
        ActiveDocument.SaveAs2 FileName:=PDFname, FileFormat:=wdFormatPDF
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote