Excel to paste data to word then convert word to PDF

ExcelAverage

New Member
Joined
Dec 10, 2012
Messages
32
Hi Excel Gurus,
I am lost again in Excel. I was able to edit someone's code to open a word document and paste data from Excel. The code I am using is below. Sorry it looks cluttered.

Code:
Private Sub MSWORD_AMSDM()
'open word file
Const wdGoToLine = 1
Const wdGoToAbsolute = 1
Dim objWord As Object
Dim objSelection As Object

    'Opens a Word Document from Excel
    Set objWord = CreateObject("Word.Application")
    
    objWord.Visible = True

    'Change the directory path and file name to the location
    'of your document
    
    objWord.Documents.Open "P:\AO Marketing\_AskAO_\2013\4. Proposals and Quotes\Templates\AMS DM\Please do not delete\AMSDMQuotation-MEA"
    
    Set objSelection = objWord.Selection
    
    objSelection.Goto wdGoToLine, wdGoToAbsolute, 1

    ' copy based on value in
   
    ActiveCell.SpecialCells(xlLastCell).Select
    Range(Selection, Cells(1)).Select
    Selection.Copy
                   
    objSelection.Paste
'end of open word
End Sub

My problem now is how to incorporate in this macro such that the Word doc will saved as PDF. The SAVE AS Pdf that I cannot figure out how to add in this code. PDF form will be saved on the same folder as the Word doc.

Appreciate if someone can help me out with the code.

Thanks very much for the usual support.

Take care everyone

Jun.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,196,055
Messages
6,013,129
Members
441,750
Latest member
Afsheen Ahmad

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top