View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Save Workbook using List Box Data

Monty,

I chuck in a deliberate error so the more astute amongst you can fix it and
learn more than just by copying. You passed. All bullshine of course, but
it's good you can anyway.

Just pre-pend the other directory to the file name like so

Sub SaveFile()
sFilename = "C:\myDir\MySubDir\Week_" & Range("AG33") & ".xls"
ActiveWorkbook.SaveAs FileName:=sFilename
End Sub

or change the directory before

Sub SaveFile()
ChDir "C:\myDir\MySubDir\"
sFilename = "eek_" & Range("AG33") & ".xls"
ActiveWorkbook.SaveAs FileName:=sFilename
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Full Monty " wrote in message
...
Bob,
I kept getting a Syntax Error withe code you provided. So I made a
change and used the following code.

Sub SaveFile()
sFilename = "Week_" & Range("AG33") & ".xls"
ActiveWorkbook.SaveAs FileName:=sFilename
End Sub

And it works great except that it places the file in the normal program
folder and I need it in a sub folder.


Any suggestions?


---
Message posted from http://www.ExcelForum.com/