Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Saving a spreadsheet without saving the Macro

I have a spreadsheet that I use as a template. When a user opens the
spreadsheet it runs a macro (using Auto_Open). This macro does its thing
with the data and then saves the spreadsheet.

The problem is that the macro is saved with the spreadsheet. Because of the
Auto_Open, the user has to dispable macros when they open the saved
spreadsheet.

Is there a way, using VBA, to save the spreadsheet without the macro?

Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Saving a spreadsheet without saving the Macro

Is it a real template ? xlt

--
Regards Ron de Bruin
http://www.rondebruin.nl


"tedd13" wrote in message ...
I have a spreadsheet that I use as a template. When a user opens the
spreadsheet it runs a macro (using Auto_Open). This macro does its thing
with the data and then saves the spreadsheet.

The problem is that the macro is saved with the spreadsheet. Because of the
Auto_Open, the user has to dispable macros when they open the saved
spreadsheet.

Is there a way, using VBA, to save the spreadsheet without the macro?

Thank you.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Saving a spreadsheet without saving the Macro

Sorry, no it's just a spreadsheet. I guess I shouldn't call it that. Would
it make a difference if I saved it as a template?

Thanks



"Ron de Bruin" wrote:

Is it a real template ? xlt

--
Regards Ron de Bruin
http://www.rondebruin.nl


"tedd13" wrote in message ...
I have a spreadsheet that I use as a template. When a user opens the
spreadsheet it runs a macro (using Auto_Open). This macro does its thing
with the data and then saves the spreadsheet.

The problem is that the macro is saved with the spreadsheet. Because of the
Auto_Open, the user has to dispable macros when they open the saved
spreadsheet.

Is there a way, using VBA, to save the spreadsheet without the macro?

Thank you.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Saving a spreadsheet without saving the Macro

If you save it as a real template you can test the path

You can test the ThisWorkbook path
A real template have no path

Sub Auto_Open()
If Len(ThisWorkbook.Path) = 0 Then
MsgBox "run the code it is a template"
Else
MsgBox "The file is a xls do nothing"
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"tedd13" wrote in message ...
Sorry, no it's just a spreadsheet. I guess I shouldn't call it that. Would
it make a difference if I saved it as a template?

Thanks



"Ron de Bruin" wrote:

Is it a real template ? xlt

--
Regards Ron de Bruin
http://www.rondebruin.nl


"tedd13" wrote in message ...
I have a spreadsheet that I use as a template. When a user opens the
spreadsheet it runs a macro (using Auto_Open). This macro does its thing
with the data and then saves the spreadsheet.

The problem is that the macro is saved with the spreadsheet. Because of the
Auto_Open, the user has to dispable macros when they open the saved
spreadsheet.

Is there a way, using VBA, to save the spreadsheet without the macro?

Thank you.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Saving a spreadsheet without saving the Macro

Another way is to delete the VBA
See Chip Pearson's site
http://www.cpearson.com/excel/vbe.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"tedd13" wrote in message ...
Sorry, no it's just a spreadsheet. I guess I shouldn't call it that. Would
it make a difference if I saved it as a template?

Thanks



"Ron de Bruin" wrote:

Is it a real template ? xlt

--
Regards Ron de Bruin
http://www.rondebruin.nl


"tedd13" wrote in message ...
I have a spreadsheet that I use as a template. When a user opens the
spreadsheet it runs a macro (using Auto_Open). This macro does its thing
with the data and then saves the spreadsheet.

The problem is that the macro is saved with the spreadsheet. Because of the
Auto_Open, the user has to dispable macros when they open the saved
spreadsheet.

Is there a way, using VBA, to save the spreadsheet without the macro?

Thank you.








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Saving a spreadsheet without saving the Macro

Thanks I will check that out.

Maybe I am going about this the wrong way. When the user opens my
spreadsheet it opens a text file, does lots of formating and totalling, and
then saves the spreadsheet in a folder with a different name.

I thought that there might be something I could add to the code that saves
the spreadsheet so that it no longer has the macro.

I tried saving it as a template but it still runs the macro. The user can
always disable macros but I would rather they didn't have to do that.

Thanks

"Ron de Bruin" wrote:

Another way is to delete the VBA
See Chip Pearson's site
http://www.cpearson.com/excel/vbe.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"tedd13" wrote in message ...
Sorry, no it's just a spreadsheet. I guess I shouldn't call it that. Would
it make a difference if I saved it as a template?

Thanks



"Ron de Bruin" wrote:

Is it a real template ? xlt

--
Regards Ron de Bruin
http://www.rondebruin.nl


"tedd13" wrote in message ...
I have a spreadsheet that I use as a template. When a user opens the
spreadsheet it runs a macro (using Auto_Open). This macro does its thing
with the data and then saves the spreadsheet.

The problem is that the macro is saved with the spreadsheet. Because of the
Auto_Open, the user has to dispable macros when they open the saved
spreadsheet.

Is there a way, using VBA, to save the spreadsheet without the macro?

Thank you.






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Saving a spreadsheet without saving the Macro

Working OK for me in the template

The macro will run but now you can do what you want

Sub Auto_Open()
If Len(ThisWorkbook.Path) = 0 Then
MsgBox "run the code it is a template"
Else
MsgBox "The file is a xls do nothing"
End If
End Sub

when you open the template you will see the first msgbox and when you save it as a xls and open the file you see the
second one(you can delete this line)

This way the code will only run if the file is a xlt and not ais it is xls


--
Regards Ron de Bruin
http://www.rondebruin.nl


"tedd13" wrote in message ...
Thanks I will check that out.

Maybe I am going about this the wrong way. When the user opens my
spreadsheet it opens a text file, does lots of formating and totalling, and
then saves the spreadsheet in a folder with a different name.

I thought that there might be something I could add to the code that saves
the spreadsheet so that it no longer has the macro.

I tried saving it as a template but it still runs the macro. The user can
always disable macros but I would rather they didn't have to do that.

Thanks

"Ron de Bruin" wrote:

Another way is to delete the VBA
See Chip Pearson's site
http://www.cpearson.com/excel/vbe.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"tedd13" wrote in message ...
Sorry, no it's just a spreadsheet. I guess I shouldn't call it that. Would
it make a difference if I saved it as a template?

Thanks



"Ron de Bruin" wrote:

Is it a real template ? xlt

--
Regards Ron de Bruin
http://www.rondebruin.nl


"tedd13" wrote in message ...
I have a spreadsheet that I use as a template. When a user opens the
spreadsheet it runs a macro (using Auto_Open). This macro does its thing
with the data and then saves the spreadsheet.

The problem is that the macro is saved with the spreadsheet. Because of the
Auto_Open, the user has to dispable macros when they open the saved
spreadsheet.

Is there a way, using VBA, to save the spreadsheet without the macro?

Thank you.








  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Saving a spreadsheet without saving the Macro

I tried that out and it works!

Thanks for your help!



"Ron de Bruin" wrote:

Working OK for me in the template

The macro will run but now you can do what you want

Sub Auto_Open()
If Len(ThisWorkbook.Path) = 0 Then
MsgBox "run the code it is a template"
Else
MsgBox "The file is a xls do nothing"
End If
End Sub

when you open the template you will see the first msgbox and when you save it as a xls and open the file you see the
second one(you can delete this line)

This way the code will only run if the file is a xlt and not ais it is xls


--
Regards Ron de Bruin
http://www.rondebruin.nl


"tedd13" wrote in message ...
Thanks I will check that out.

Maybe I am going about this the wrong way. When the user opens my
spreadsheet it opens a text file, does lots of formating and totalling, and
then saves the spreadsheet in a folder with a different name.

I thought that there might be something I could add to the code that saves
the spreadsheet so that it no longer has the macro.

I tried saving it as a template but it still runs the macro. The user can
always disable macros but I would rather they didn't have to do that.

Thanks

"Ron de Bruin" wrote:

Another way is to delete the VBA
See Chip Pearson's site
http://www.cpearson.com/excel/vbe.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"tedd13" wrote in message ...
Sorry, no it's just a spreadsheet. I guess I shouldn't call it that. Would
it make a difference if I saved it as a template?

Thanks



"Ron de Bruin" wrote:

Is it a real template ? xlt

--
Regards Ron de Bruin
http://www.rondebruin.nl


"tedd13" wrote in message ...
I have a spreadsheet that I use as a template. When a user opens the
spreadsheet it runs a macro (using Auto_Open). This macro does its thing
with the data and then saves the spreadsheet.

The problem is that the macro is saved with the spreadsheet. Because of the
Auto_Open, the user has to dispable macros when they open the saved
spreadsheet.

Is there a way, using VBA, to save the spreadsheet without the macro?

Thank you.









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
Automaticly saving formula's to values when saving Gunti Excel Discussion (Misc queries) 8 November 11th 08 09:34 AM
Saving spreadsheet Beginner Excel User Excel Worksheet Functions 2 March 21st 06 08:45 PM
Saving or not a spreadsheet Dean Excel Programming 4 December 14th 05 08:20 AM
Saving a Workbook: Forcing User to Rename before Saving Rollin_Again[_6_] Excel Programming 5 April 16th 04 02:54 PM
Writing a macro so that when saving a spreadsheet the data cannot be changed Michael I Excel Programming 3 September 18th 03 03:16 PM


All times are GMT +1. The time now is 05:43 PM.

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"