save as text crashes Tom Ogilvy

J

Janis

If this is true then why does the "Indesigndate.txt workbook name appear on
the sspdate.xls workbook sheet1?




Open a textfile in excel using File=>Open. Notice that there is only one
worksheet and it has the same name as the file. This is just the way excel
operates - a textfile has no provision for saving sheet names, formatting and
other stuff associated with a workbook.

Generally workbooks "crash" because our code does something it shouldn't

--
Regards,
Tom Ogilvy


Janis said:
Maybe its okay, I just ran it again and it didn't crash. But I've noticed
the personal workbook gets corrupted a lot. I have to make sure that it
isn't a recovered one I'm working on. That seems to be when it crashes.

In any case, this macro I mentioned needs to save a text file. So I am in
the original file
and I have to save two files in order to get it to save a text file.
Otherwise it can't use saveas. It saves a text file names
indesigndate&time.txt. It also saves the original file as sspdate&time.xls.
This ssp...txt file has the name of the indesign...txt file as the first
sheet.

The original file closes unchaged. This new xls file is left open as I said
with the sheet1 name changed. I can still proceed with other process macros
by changing them to act on sheets(1) as a collection instead of using the
"sheet1" name because the name is no longer sheet1.

I wish I knew why my personal workbook keeps crashing. I think I need to
build in some error trapping. any suggestions are helpful.


was the generic name for sheet 1 no matter what else you use for the public ; > name. Am I wrong?
gt; "Janis said:
I like this macro it does what I want and its easy to understand. It closes
book1.xls as the original. It saves two copies one as a text file. The
other one remains open. The only problem is on the one that remains open,
the new ssp....xls file, it renames (sheet1) as the Indesign....txt file.

Since I use sheet1 in the next macros to do some formatting, I got around
that by naming it as a collection.
gt; With ActiveWorkbook.Worksheets(1)
With activeworkbook.workseets(sheet1)
But I wonder why it changes the name of the sheet to the name of the first
file that was saved. Its a little weird and it crashes I think more than
not. Maybe I am better off doing the save a different way?
gt; thanks,

Thank you
 
T

Tom Ogilvy

sspdate.xls
appears to be an xls file. It can have any name you want to give it as long
as it has a legal construct.

Or are you saying you opened a textfile named sspdate.xls (text file, not
excel file) and the single sheet had the name Indesigndate.txt? If you are
saying that, then you are indeed the owner of a very special version of
excel.

this is the way it happens for me:

? activeworkbook.Name
dir.txt
? activeworkbook.Worksheets(1).name
dir


--
regards,
Tom Ogilvy
 
J

Janis

I think I figured out the answer, the .txt save is first. If I do the xls
save first it doesn't do it. THANKs,.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top