Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Assign macro

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Assign macro

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Assign macro

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assign a Macro The Rook[_2_] Excel Discussion (Misc queries) 5 February 19th 07 06:53 PM
assign a macro daidipya Excel Discussion (Misc queries) 4 May 30th 06 02:51 PM
assign macro PH NEWS Excel Worksheet Functions 2 February 28th 06 02:17 PM
How to assign a macro Mike Excel Discussion (Misc queries) 4 July 5th 05 06:43 AM
still can't assign MACRO grin2000[_11_] Excel Programming 3 June 22nd 04 04:17 AM


All times are GMT +1. The time now is 08:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"