View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.misc
David Nebenzahl David Nebenzahl is offline
external usenet poster
 
Posts: 9
Default Annoying problem saving sheet w/macros as CSV

On 12/13/2007 10:10 AM Dave Peterson spake thus:

I read your message that you were saving your file with the macro as a .csv file
(or discarding it).

.CSV files (and other text files (.prn, .txt)) are just plain old text files.
They won't include any of your code or any of your formatting or any of your
formulas.

So when you need a macro that can be re-run when you want, you can put that
macro in a workbook--but save that workbook as a normal .xls file--not .csv.

Then whenever you need to run the macro,
you can open your workbook with the macro.
Then open your data file (.csv or what you want)
then alt-f8 to select the macro to run (from the macro workbook).

If you write the macro so that it works against the activesheet (no sheet names,
no workbook names), it should work ok.


Maybe I wasn't clear: the macro IS in a normal .xls file. Let me explain
again, hopefully more clearly:

I have an Excel workbook with several sheets. It contains the macro. One
of the sheets ("work") is a temporary work area where I copy records
from the other sheets for export. The macro takes those records in
"work" and reformats them. I then save the "work" sheet ONLY as a CSV
file for export. I use the CSV file, then discard (delete) it. The .xls
workbook remains unchanged.

All this works wonderfully well. The problem is that the next time I try
to use the .xls file, Excel wants to look in the CSV file for the macro
and says "I can't find it!", when the macro is really still in the .xls
file.

Does this make sense?