Excel VBA - Create Word Doc, Save PDF and email to recipient

Sbowes

New Member
Joined
Sep 20, 2014
Messages
1
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:



  1. reference a cell in the excel doc and also add the current date as the name to save the file as.
  2. Save it as PDF
  3. 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
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,214,787
Messages
6,121,565
Members
449,038
Latest member
Guest1337

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