Save in VBA and send with Outlook

KlausW

Active Member
Joined
Sep 9, 2020
Messages
378
Office Version
  1. 2016
Platform
  1. Windows
Hi Excel helpers
Is it possible to make this VBA code so that it only stores the tabs I have written in the code. And under a name in cell B, in PDF format.
Is it also possible to make the code so that after saving it will send, using Outlook, to an email address in cell H1.
All help will be appreciated
Klaus W
VBA Code:
Sub Rektangelafrundedehjørner1_Klik()

 'Create and assign variables
Dim saveLocation As String
saveLocation = "C:\Users\k-wit\Documents\Rejseafregning\myPDFFile.pdf"
sheetArray = Array("Rejsebeskrivelse", "Koerselsrapport ", "Færgekort", "Billeter")
'Save active workbook as PDF
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, _
    Filename:=saveLocation

End Sub
 
Ok ... if you are still receiving an error message due to that line of code, you can delete that line of code. It should not have
a negative effect on the rest of the macro.
 
Upvote 0

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Ok ... if you are still receiving an error message due to that line of code, you can delete that line of code. It should not have
a negative effect on the rest of the macro.
Good morning from Denmark, what happens when the other part of the macro does not run is that I can not send. But I can only send it manually from outlook. Best regards Klaus W
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,252
Members
449,075
Latest member
staticfluids

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