View Single Post
  #2   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

Off the top.

sFilename = "Week_" &
Format(Worksheets("Sheet1").ListBox1.Value,"00") & ".xls"
ACtiveworkbook.SaveAs Filename:= sFilename

You could put this code in the Listbox Click event.

This assumes a worksheet list box. If it is a userform replace
Worksheets("Sheet1") by Userform1, or whatever the form is called.

--

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
...
Excel 97 Version

Instead of my customers having to use the "Save As" function, I was
wondering if VBA can do it for me based on cell contents? Here is what
I want to accomplish.

I have a List Box with 0-26 numbers listed for the customer to select a
number from.
The moment they select a number from the List Box, I want the program
saved as "Week_" and then the number they selected.

I also want a message box to appear stating that the file new file
name.

The list box is linking to cell AF33

Thanks in advance!


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