sheetsinnewworkbook

G

grt

hi,
i'm used the following line in a macro:
Application.SheetsInNewWorkbook = 1
the result is okay, meaning that I only get a workbook with
a single sheet added. However I would like to retrieve the
settings as they were before I run the macro.
tia
 
J

JE McGimpsey

grt said:
hi,
i'm used the following line in a macro:
Application.SheetsInNewWorkbook = 1
the result is okay, meaning that I only get a workbook with
a single sheet added. However I would like to retrieve the
settings as they were before I run the macro.
tia

One way:

Dim nOldSheetsInNewWorkbook As Long
nOldSheetsInNewWorkbook = Application.SheetsInNewWorkbook
Application.SheetsInNewWorkbook = 1
'do stuff
Application.SheetsInNewWorkbook = nOldSheetsInNewWorkbook
 

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