ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Test if workbook is not yet named (https://www.excelbanter.com/excel-programming/419143-test-if-workbook-not-yet-named.html)

wal

Test if workbook is not yet named
 
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.


Jim Cone[_2_]

Test if workbook is not yet named
 
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.


Harald Staff[_2_]

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

HTH. Best wishes Harald

"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.




All times are GMT +1. The time now is 05:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com