ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Creating a new excel file programatically (https://www.excelbanter.com/excel-programming/340892-creating-new-excel-file-programatically.html)

Chimanrao

Creating a new excel file programatically
 
I am writing a plugin with which , when the user clicks a button, I
want to save the active sheet in a new excel file.

How do I create a new excel file programatically?
howo do I add a existing sheet to this file?

Regards
Chimanrao


Nigel

Creating a new excel file programatically
 
In the simplest form use.......

ActiveWorkbook.SaveAs Filename:="C:\Copy of Book.xls"

Sheets.Add

--
Cheers
Nigel



"Chimanrao" wrote in message
oups.com...
I am writing a plugin with which , when the user clicks a button, I
want to save the active sheet in a new excel file.

How do I create a new excel file programatically?
howo do I add a existing sheet to this file?

Regards
Chimanrao




Chimanrao

Creating a new excel file programatically
 
I want to save only the active worksheet...

regards
Chimanrao


Rowan[_9_]

Creating a new excel file programatically
 
Try:

Sub newbook()
ActiveSheet.Copy
ActiveWorkbook.SaveAs "c:\Temp\MyNewBook.xls"
End Sub

Hope this helps
Rowan

Chimanrao wrote:
I want to save only the active worksheet...

regards
Chimanrao


Nigel

Creating a new excel file programatically
 
Sheets("Sheet1").Select
Sheets("Sheet1").Copy
Sheets.Add
ActiveWorkbook.SaveAs Filename:="C:\new book.xls"

--
Cheers
Nigel



"Chimanrao" wrote in message
oups.com...
I want to save only the active worksheet...

regards
Chimanrao





All times are GMT +1. The time now is 01:24 PM.

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