ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   open new workbook (https://www.excelbanter.com/excel-programming/410131-re-open-new-workbook.html)

Gary Keramidas

open new workbook
 
how about something like this:

Sub test2()
Dim wb1 As Workbook
Dim shts As Long
Dim fpath As String

fpath = ActiveWorkbook.Path & "\"
With Application
shts = .SheetsInNewWorkbook
.SheetsInNewWorkbook = 1
Workbooks.Add
.SheetsInNewWorkbook = shts
End With
ActiveWorkbook.SaveAs Filename:=fpath & "test.xls"
End Sub

--


Gary


"John" wrote in message
...
How do I open and name a new workbook with only 1 worksheet in vb? I tried
learning how using record macro but couldn't get things to work.

thanks

John





All times are GMT +1. The time now is 10:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com