select range of excel table, apply filname of a certain cell, choose directory

sailor1301

New Member
Joined
Feb 5, 2021
Messages
1
Office Version
  1. 2010
Platform
  1. Windows
Hi everybdy,

this is my first post in this forum, so I kindly asl for a little bit of patience

What I need:
1. From an big table I would like to select a certain range of choice
2. thefilename would be applied from a specific cell
3. the file should be saved either in a specific directory (G:\3100\Team 3100\Jour Fixe\Jour-fixe TEAM 3100\) OR by choice to select a specific folder (Here I would be happy to have two options as some departments would use option 1 and others option 2)

I have used to following code: the original code gives a fixed filename.
When I add an adress I get an syntax error message

I would be very greatful for help thanks i advance

Stefan (from Austria)

Sub pdf_neu1()

Dim saveLocation As String

'saveLocation = "G:\3100\Team 3100\Jour Fixe\Jour-fixe TEAM 3100\myPDFFile.pdf"
saveLocation = "G:\3100\Team 3100\Jour Fixe\Jour-fixe TEAM 3100\& Range("T2").Value & ".pdf""

Selection.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=saveLocation

End Sub
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,223,912
Messages
6,175,341
Members
452,638
Latest member
Oluwabukunmi

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