VBA macro for PDF

rodrigominatto

New Member
Joined
Jul 26, 2021
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
Hello,
i'm having throubles with my VBA code, in the folder location.
this sheet is in a google drive folder, and 3 people uses it, how can i create a macro for saving in PDF a selected area and save in the correct folder, becouse how its a google drive, in my computer the way to the folder its diferente from the others,

Can someone help me?
Sub pdf()
'
' pdf Macro
'

Dim Nome As String

Sheets("Email").Select
Nome = ThisWorkbook.Path & Cells(2, 10).Value & " " & Cells(2, 11).Value & " - " & Cells(3, 10).Value & " à " & Cells(3, 11).Value & ".pdf"
Sheets("P.S. AÇO 015-20").Select
Range("A4:H48").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Nome, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True

End Sub

thx
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
you may have forgot a backslash:
ThisWorkbook.Path & "\" & Cells(2, 10).Val....
thx but does not work
1627323105302.png
 
Upvote 0
for the file name try this and lets see if it works. Filename:= Application.GetSaveAsFilename,
 
Upvote 0

Forum statistics

Threads
1,214,822
Messages
6,121,765
Members
449,049
Latest member
greyangel23

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