ExcelBanter

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

kishore

Creating a excel file
 
Hi,

Just curious to know, is it possible to creat a excel file if it does
not exists in the given folder. Any code to do this???

Thanks in advance,
Kishore


Ron de Bruin

Creating a excel file
 
Try this kishore

Sub Test()
Dim mywkbk As Workbook
Dim myfile As String
Dim wb As Workbook
myfile = "C:\Data\test.xls"
If Dir(myfile) = "" Then
Set wb = Workbooks.Add
wb.SaveAs "C:\Data\test.xls"
wb.Close False
Else
MsgBox "Exist!"
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"kishore" wrote in message oups.com...
Hi,

Just curious to know, is it possible to creat a excel file if it does
not exists in the given folder. Any code to do this???

Thanks in advance,
Kishore





All times are GMT +1. The time now is 10:55 AM.

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