View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Annoying problem saving sheet w/macros as CSV

Why not create a normal workbook that contains the code that does the work.

And just open that workbook when you need to run the macro.



David Nebenzahl wrote:

This is a really annoying problem: I have a worksheet with a macro I
wrote to do some reformatting on one of the sheets before I submit it as
a CSV file to a database. I set up a button on the toolbar linked to the
macro: when I open the file, move my data to this one sheet and click
the button, the macro runs as it should.

I then save that sheet as a CSV file; I basically say "no" to all the
warning alerts that pop up, warning me that in that format it's only
possible to save that particular sheet (which is the only one I'm
interested in for that purpose anyhow), etc. The CSV file gets created
correctly. Then I just abandon the now-CSV workbook. Fine.

The problem is that the next time I open the Excel version of the
workbook (which was NOT saved in its altered state), I cannot run the
macro by using the toolbar button: I get an error message saying it
can't find <mumbo-jumbo ... macro-name.CSV. Even weirder, it also opens
the CSV file at the same time. (I can run the macro by invoking it
through the Tools menu, but the button is intended to make this whole
process easy for non-computer-literate types, and this defeats that
purpose.)

When I delete the CSV file, which is only needed temporarily, then
things get even uglier: Excel complains that it can't find the CSV file
when I'm working with the normal (XLS) version of the workbook.

Is there some way to get Excel to disassociate or disentangle itself
from this CSV file so I don't run into all these problems? It seems that
only a system reboot makes the XLS file usable again.


--

Dave Peterson