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
 
Top