LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i open a second workbook using a vba code [email protected] uk Excel Discussion (Misc queries) 10 November 28th 09 05:42 PM
Need VB code for workbook open to open a link Daniel Baker Excel Discussion (Misc queries) 2 August 18th 06 01:30 AM
Need VBA Code to Open a Workbook in read only zulfer7 Excel Discussion (Misc queries) 1 July 10th 06 11:00 PM
Workbook Open code Mike Tomasura Excel Programming 0 August 1st 03 05:32 PM
Workbook Open code Chip Pearson Excel Programming 0 August 1st 03 05:29 PM


All times are GMT +1. The time now is 07:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"