Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you're using xl97, then show the properties for that commandbutton and change
its "takefocusonclick" property to false. (A bug in xl97 that was fixed in xl2k.) But that underscore and ampersand are important. The underscore means that the VBA statement is continued on the next line. The ampersand means that we're taking two things and jamming them together (concatenating). ActiveWorkbook.SaveAs Filename:="C:\" _ worksheets("sheet1").range("a1").value & ".xls" Make sure you didn't delete the space in front of the underscore either. (and if the cell contained .xls, you wouldn't need this -- & ".xls" And watch out for this: f9:g9. You're looking at two cells and can't pick up the value this way. If one of them contained the folder and one contained the filename, this format would be closer: ActiveWorkbook.SaveAs Filename:="C:\" _ worksheets("sheet1").range("f9").value & _ worksheets("sheet1").range("g9").value & ".xls" If this doesn't work for you, then include what's in those two cells in your next post. Darrin Henry wrote: This is what I have now, the command button invokes the save. However, the "_" and "&" do not work, I had to remove them, I don't know if they are needed or not. Also I get a Run-time error '1004'. The contents of the cell is going to be something like CCHenry091003. Thanks. Private Sub CommandButton1_Click() ActiveWorkbook.SaveAs Filename:="C:\" Worksheets("sheet1").Range("f9:g9").Value ".xls" End Sub *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using SaveAs | Excel Discussion (Misc queries) | |||
SaveAs - VBA | Excel Discussion (Misc queries) | |||
SaveAs - VBA | Excel Discussion (Misc queries) | |||
VBA SaveAs Value | Excel Discussion (Misc queries) | |||
SaveAs | Excel Worksheet Functions |