Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 177
  • Last Modified:

Macro does not save with Excel Template

I have created an Excel 2003 template file and a macro assigned to a toolbar button.  The macro saves the template as a CSV file (hotfile.csv) and closes the application.  The next time I open the template file (hotfile.xlt), I click on the macro button and it tells me that it can't find the hotfile.csv macro.

What happens is the macro button is re-assigned to the CSV file during the SaveAs process.  

How can I keep the macro assigned to the toolbar button in the template (Hotfile.xlt)?
0
BartowIT
Asked:
BartowIT
  • 3
1 Solution
 
karl-henrikCommented:
If i understnad your problem correctly you need to choose the Macro Enabled Template (*.xltm) option
0
 
andrewssd3Commented:
It won't be the macro enabled thing because you are on Excel 2003.  It sounds as though you are somehow saving your template file after doing the csv save as.  This should not happen if you are using the template correctly - you must open it with File...New, or right click on it and choose New - NOT Open, which opens the template itself.  You should get a new .xls file based on the template when you open it, then the underlying template won't get changed.
0
 
BartowITAuthor Commented:
My only option is to use Excel 2003 files, so xltm won't work.  

I'm sure it's sometihng in my VB, as I had a file once before that worked just fine.  I need the macro to stay with the XLT, not the CSV file.  It's quite strange.
0
 
BartowITAuthor Commented:
It appears this is a problem with Excel?  I installed Excel 2007 the script works.  


The line that was throwing me off in 2003 is ThisWorkbook.SaveAs Filename:

0
 
BartowITAuthor Commented:
Installing 2007 was a work around
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now