+ Reply to Thread
Results 1 to 2 of 2

how to create excel file when clicking on the button.

  1. #1
    Registered User
    Join Date
    10-19-2005
    Posts
    38

    Question 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...

  2. #2
    chijanzen
    Guest

    RE: 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
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1