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.
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.
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.