![]() |
#1
|
|||
|
|||
![]()
Hi,
I am trying to create a macro that will enable the user to save a word document as pdf. Below are the steps which must happen in order: 1. Click SaveAsPdf button 2. An input box appears asking user to name the document. 3. Convert word document to pdf 4. A dialog box appears enabling the user to browse and select location to save the pdf 5. Attach the pdf on a new email as an attachment in outlook. 6. Msgbox pops up asking the user if they want to save the word document. If Yes, repeat step 4 (dialog box must default to the location where the pdf was saved). My macro takes care of steps 1, 2, 3 and 5. I am having difficulties with step 4. Any help would be much appreciated. Below is my code: Code:
Sub SaveAsPDF() Dim dlgSaveAs As FileDialog, strFile As String Dim strPath As String 'Renaming document and selecting path to save to strFile = InputBox("Please Enter Filename") On Error Resume Next 'Converting document to pdf ActiveDocument.ExportAsFixedFormat OutputFileName:= _ strFile _ , ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _ wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=1, _ Item:=wdExportDocumentWithMarkup, IncludeDocProps:=False, KeepIRM:=True, _ CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _ BitmapMissingFonts:=True, UseISO19005_1:=False MsgBox "Document converted to .pdf, please select location to save" Set dlgSaveAs = Application.FileDialog(msoFileDialogFolderPicker) dlgSaveAs.InitialFileName = "default path" dlgSaveAs.Show If Err Then MsgBox "Document not saved": Exit Sub 'Saving the document ActivePresentation.SaveAs strFile MsgBox "You saved the file to:" & vbNewLine & strFile End Sub |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How Do I Convert XML to Word? | Synful | Word | 13 | 11-23-2014 02:18 PM |
![]() |
Esgrimidor | Word VBA | 11 | 12-03-2012 03:44 PM |
![]() |
priya | Word | 1 | 10-07-2011 11:03 AM |
![]() |
gonner | Word | 1 | 09-10-2011 03:25 AM |
![]() |
vijayaram | Word | 1 | 12-30-2009 08:25 AM |