ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to create excel file when clicking on the button. (https://www.excelbanter.com/excel-programming/345137-how-create-excel-file-when-clicking-button.html)

areddy[_25_]

how to create excel file when clicking on the button.
 

Hi All,

I have one vb form in that one button is there.when I click on the
button
Excel file should create in "C:\Program Files\Admin\test" path.

I don't want to open the excel file when click on the button just i
want create the excel file in above specified path.

This is the code iam writing under button _click event

Dim objExcel As Excel. Application

Set objExcel = New Excel.Application

What are the next lines.

Please help me on this.

thanks,
Amar...


--
areddy
------------------------------------------------------------------------
areddy's Profile: http://www.excelforum.com/member.php...o&userid=28204
View this thread: http://www.excelforum.com/showthread...hreadid=483458


chijanzen

how to create excel file when clicking on the button.
 
Hi areddy:

Try something like:

Dim objExcel As Excel.Application
Dim wbk As Workbook
Set objExcel = New Excel.Application
objExcel.Visible = True
Set wbk = objExcel.Workbooks.Add
wbk.Worksheets(1).Range("A1") = "OK"
wbk.SaveAs FileName:="C:\123.xls"
Set wbk = Nothing
objExcel.Quit
Set objExcel = Nothing

--

http://www.vba.com.tw/plog/


"areddy" wrote:


Hi All,

I have one vb form in that one button is there.when I click on the
button
Excel file should create in "C:\Program Files\Admin\test" path.

I don't want to open the excel file when click on the button just i
want create the excel file in above specified path.

This is the code iam writing under button _click event

Dim objExcel As Excel. Application

Set objExcel = New Excel.Application

What are the next lines.

Please help me on this.

thanks,
Amar...


--
areddy
------------------------------------------------------------------------
areddy's Profile: http://www.excelforum.com/member.php...o&userid=28204
View this thread: http://www.excelforum.com/showthread...hreadid=483458




All times are GMT +1. The time now is 05:19 PM.

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