macro challenge

msm205

New Member
Joined
Oct 12, 2002
Messages
34
I am trying to save a file to a specific directory, C:, with a file name contained in the cell A1. I thought this code was a start, but it's not working. Please help.

Public Sub SaveAsA1()
ThisFile = Range("A1").Value
ActiveWorkbook.SaveAs Filename:=ThisFile
End Sub
 

Some videos you may like

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Asala42

Well-known Member
Joined
Feb 26, 2002
Messages
2,318
WorkbookName = Worksheets("Sheet1").Range("A1").Text
ActiveWorkbook.SaveAs Filename:= _
"C:" & WorkbookName & ".xls "
This message was edited by Asala42 on 2002-11-11 21:49
 

apurk45

Board Regular
Joined
Oct 23, 2002
Messages
215
Jack

Can I add the path to your formula ??

FileName = Range("A1").Value
ThisWorkbook.SaveAs FileName:=C:MT ReportsFileName

Would this work???
 

Jack in the UK

Well-known Member
Joined
Feb 16, 2002
Messages
3,215
Hi

Sorry for the delay

add this C:MT ReportsFileName into A1 and run the code - does that work, ive not tested as its 2am in London now SLEEP i get up at 6am for work, as you know i live on this site

PM or email if you get suck
jackintheuk@hotmail.com

HTH

JITUK
 

Watch MrExcel Video

Forum statistics

Threads
1,123,384
Messages
5,601,323
Members
414,442
Latest member
Oleg

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
Top