Test if workbook is not yet named

W

wal

Excel 2003

I have a simple SaveAll macro using For Each...Next. It loops through
open workbooks and saves them.

If a new, as-yet-unnamed workbook is open, the macro will save that as
Book1.xls in My Documents, without a prompt. (Of course, if you hit
Ctrl-S when that workbook is active, you get the Save dialog.)

How can you test whether a workbook has been unnamed or never-been-
saved? I would include that code to skip that workbook in the For
Each loop.

Thanks.
 
J

Jim Cone

Check the length of the workbook path.
--
Jim Cone
Portland, Oregon USA


"wal"
wrote in message
Excel 2003
I have a simple SaveAll macro using For Each...Next. It loops through
open workbooks and saves them.
If a new, as-yet-unnamed workbook is open, the macro will save that as
Book1.xls in My Documents, without a prompt. (Of course, if you hit
Ctrl-S when that workbook is active, you get the Save dialog.)
How can you test whether a workbook has been unnamed or never-been-
saved? I would include that code to skip that workbook in the For
Each loop.
Thanks.
 
H

Harald Staff

You could also check if Dir(workbook.fullname) <> "", meaning this is a
file?

HTH. Best wishes Harald
 

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