Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Is there a way to create a new workbook and give it a name (for referencing) without saving the file? I currently use SaveAs, but don't really need to keep the file. However, I do need to jump between files so need to be able to reference this new workbook. It's probably something simple that I have overlooked, but any help would be greatly appreciated. My function is currently Function NewWorkbookFunc(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 NewWorkbook.SaveAs Filename:=curPath & "\Comparison_" & Format(Date, "yyyy_mm_dd") Worksheets.Add().Name = "Comparison" Application.SheetsInNewWorkbook = OriginalWorksheetCount End Function Can I just remove the SaveAs line and refer to NewWorkbook when activating the new workbook? Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
In Excel 2003, how do I automate file naming/saving + date? | Setting up and Configuration of Excel | |||
Naming and saving a workbook | Excel Programming | |||
Naming a workbook WITHOUT saving it? | Excel Programming | |||
Naming a workbook WITHOUT saving it? | Excel Programming | |||
Naming a workbook WITHOUT saving it? | Excel Programming |