Start empty Excel workbook without any worksheets -
creating new excel workbook in:
dim xl excel.application dim wb excel.workbook set xl = new excel.application xl.visible = false set wb = xl.workbooks.add
is there easy way stop excel automatically creating sheet1, sheet2, sheet3?
i can delete these unwanted sheets afterwards feels clunky solution.
xl.sheetsinnewworkbook = 1
more information on msdn (scroll down add method applies workbooks object.
)
full code:
dim xl excel.application dim wb excel.workbook dim restoresheetsinnewworkbook long set xl = new excel.application restoresheetsinnewworkbook = xl.sheetsinnewworkbook xl.sheetsinnewworkbook = 1 set wb = xl.workbooks.add xl.sheetsinnewworkbook = restoresheetsinnewworkbook 'or set 3'
Comments
Post a Comment