Hi there,
I'm a bit of a novice when it comes to VBAs and I'm trying to copy data from excel to word. I have managed to get the required info to pull into word but am struggling to save as PDF and email to recipient.
I am trying to do the following but do not no the correct code:
It's taken me all day to get this far! Please could someone give me a hand on finishing this macro?
Thanks a lot!
S
//////////////////////////////////////////////////////////////////////////////////////////////////////
Sub copyToWord2()
Dim wrdApp As Word.Application
Set wrdApp = CreateObject("Word.Application")
Application.ScreenUpdating = False
Range("A1:B10").Copy
With wrdApp
.Documents.Open "C:\Users\Computer\Desktop\folder\invoice.docx"
.Selection.GoTo What:=wdGoToBookmark, Name:="Paste"
.Selection.PasteAndFormat (wdPasteDefault)
.Visible = True
.Documents.Save
End With
Application.CutCopyMode = False
Application.ScreenUpdating = True
MsgBox "Data Copied Across", vbInformation, "Sample"
End Sub
I'm a bit of a novice when it comes to VBAs and I'm trying to copy data from excel to word. I have managed to get the required info to pull into word but am struggling to save as PDF and email to recipient.
I am trying to do the following but do not no the correct code:
- reference a cell in the excel doc and also add the current date as the name to save the file as.
- Save it as PDF
- reference a cell in excel for the email adress to send the pdf to using outlook
It's taken me all day to get this far! Please could someone give me a hand on finishing this macro?
Thanks a lot!
S
//////////////////////////////////////////////////////////////////////////////////////////////////////
Sub copyToWord2()
Dim wrdApp As Word.Application
Set wrdApp = CreateObject("Word.Application")
Application.ScreenUpdating = False
Range("A1:B10").Copy
With wrdApp
.Documents.Open "C:\Users\Computer\Desktop\folder\invoice.docx"
.Selection.GoTo What:=wdGoToBookmark, Name:="Paste"
.Selection.PasteAndFormat (wdPasteDefault)
.Visible = True
.Documents.Save
End With
Application.CutCopyMode = False
Application.ScreenUpdating = True
MsgBox "Data Copied Across", vbInformation, "Sample"
End Sub