Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code to open new workbook
Ladies & Gents,
I wish to update my macros to open new workbooks with the required number of spreadsheets. I have the following function, but am unable to get it to work (I'm not too confidant with functions); Function NewWorkbook(wsCount As Integer) As Workbook ' creates a new workbook with wsCount (1 to 255) worksheets Dim OriginalWorksheetCount As Long Set NewWorkbook = Nothing If wsCount < 1 Or wsCount 255 Then Exit Function OriginalWorksheetCount = Application.SheetsInNewWorkbook Application.SheetsInNewWorkbook = wsCount Set NewWorkbook = Workbooks.Add Application.SheetsInNewWorkbook = OriginalWorksheetCount End Function Can anybody give me some clues either on how to get this function to work within a macro? Or does anyone have some code that will open a new workbook with a specified number of spreadsheet? Thanks in advance Andrew |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how can i open a second workbook using a vba code | Excel Discussion (Misc queries) | |||
Need VB code for workbook open to open a link | Excel Discussion (Misc queries) | |||
Need VBA Code to Open a Workbook in read only | Excel Discussion (Misc queries) | |||
Workbook Open code | Excel Programming | |||
Workbook Open code | Excel Programming |