Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SaveAs

Status
Not open for further replies.

scottie1

Programmer
Dec 12, 2003
50
GB
Hi Folks

This is just a small problem I hope. I have some code to save a workbook to a specfic location and the name of the file to be saved would be whats in cel A1.

My code

ChDir "Q:\salesupp\tss_data_in" 'set save path sub folder
ActiveWorkbook.SaveAs Worksheets(1).Range("A1").Text

the thing is if i've been using excel for a while running other macros etc sometimes when i run this code it doesnt save the file in the right place. If it doesn't save it in the place I want then it usually saves it in the system 32 folder.

Whats all that about

Cheers Folks
 
Not got excel on my work PC to test but something like

dim test as string

test = Worksheets(1).Range("A1").Text
ChDir "Q:\salesupp\tss_data_in"
ActiveWorkbook.SaveAs FileName:= _
"Q:\salesupp\tss_data_in\test", FileFormat:= _
xls, ReadOnlyRecommended:=False, CreateBackup:=False

you may need to modify slightly

David Lerwill
"If at first you don't succeed go to the pub"
 
you need to provide the FULL NAME & PATH to save the file
chdir is notoriously unreliable

Rgds, Geoff

"Three things are certain: Death, taxes and lost data. Guess which has occurred"

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top