Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a template which has a toolbar button. The buton was assigned macro to
macro - SaveToDrive. The save macro uses cell A12 to saveas name. This is a template so each new instance of the xls is blank. On first i enter 'BJS1' in A12 and the run macro, saves as A12.xls to my c: drive and closes. If I delete BJS1.xls and open new and enter 'BJS2' in A12 and save I get message 'BJS1.xls' could not be found. If I then open the template and look to see macro assigned to button it has 'BJS1.xls' assigned and not 'SaveTo Drive'. The template save is written like this: sFilename = "c:" + strcell" ActiveWorkbook.SaveAs Filename:=sFilename, _ FileFormat:=xlNormal, _ ReadOnlyRecommended:=False, _ CreateBackup:=False Application.Quit Application.StatusBar = "Application Closing." Am I missing something on the save or am I doing something wrong in assigning the macro. I am protecting the sheet and the workbook. Thanks, Bryan |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I don't understand entirely the question your asking but what is clear is that this line of code is incorrect sFilename = "c:" + strcell" on the assumption strcell is assigned a value somewhere the correct suntax is sFilename = "c:\" & strcell Mike "bryan" wrote: I have a template which has a toolbar button. The buton was assigned macro to macro - SaveToDrive. The save macro uses cell A12 to saveas name. This is a template so each new instance of the xls is blank. On first i enter 'BJS1' in A12 and the run macro, saves as A12.xls to my c: drive and closes. If I delete BJS1.xls and open new and enter 'BJS2' in A12 and save I get message 'BJS1.xls' could not be found. If I then open the template and look to see macro assigned to button it has 'BJS1.xls' assigned and not 'SaveTo Drive'. The template save is written like this: sFilename = "c:" + strcell" ActiveWorkbook.SaveAs Filename:=sFilename, _ FileFormat:=xlNormal, _ ReadOnlyRecommended:=False, _ CreateBackup:=False Application.Quit Application.StatusBar = "Application Closing." Am I missing something on the save or am I doing something wrong in assigning the macro. I am protecting the sheet and the workbook. Thanks, Bryan |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
My typo, the '\' is in the sFilename.
I assign a macro to toolbar button, macro is called 'SaveToDrive'. It saves entry in cell A12. Lets's say I enter 'BJS1' into this cell, it saves as BJS1.xls. If I open the template and look at the assign macro, it now says 'BJS1.xls' not 'SaveToDrive'. The macro assigned to the button is changing..... Thanks, Bryan "Mike H" wrote: Hi, I don't understand entirely the question your asking but what is clear is that this line of code is incorrect sFilename = "c:" + strcell" on the assumption strcell is assigned a value somewhere the correct suntax is sFilename = "c:\" & strcell Mike "bryan" wrote: I have a template which has a toolbar button. The buton was assigned macro to macro - SaveToDrive. The save macro uses cell A12 to saveas name. This is a template so each new instance of the xls is blank. On first i enter 'BJS1' in A12 and the run macro, saves as A12.xls to my c: drive and closes. If I delete BJS1.xls and open new and enter 'BJS2' in A12 and save I get message 'BJS1.xls' could not be found. If I then open the template and look to see macro assigned to button it has 'BJS1.xls' assigned and not 'SaveTo Drive'. The template save is written like this: sFilename = "c:" + strcell" ActiveWorkbook.SaveAs Filename:=sFilename, _ FileFormat:=xlNormal, _ ReadOnlyRecommended:=False, _ CreateBackup:=False Application.Quit Application.StatusBar = "Application Closing." Am I missing something on the save or am I doing something wrong in assigning the macro. I am protecting the sheet and the workbook. Thanks, Bryan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Assign a Macro | Excel Discussion (Misc queries) | |||
assign a macro | Excel Discussion (Misc queries) | |||
assign macro | Excel Worksheet Functions | |||
How to assign a macro | Excel Discussion (Misc queries) | |||
still can't assign MACRO | Excel Programming |