Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005

    Question Unanswered: without opening excel i want to save the excel in some specified location

    Hi All,

    Through vb iam populating some data from database and that data iam placing in excel by clicking the one button in vb application.

    But for me I don't want to open the excel file when I click on the button. I want to place the excel file with data when I click on the button in some specific path(example - C:\Program Files\Admin folder\test.xls)

    After placing the path it should display one message "please refer your test.xls file from C:\Program Files\Admin folder”

    While clicking on the button it should not display the excel file. That should restrict.
    Please help me on this


  2. #2
    Join Date
    Oct 2005
    as in handle
    What you want may be something liken this?
    Private Sub Button_Click()
    Dim xlBook As Object
    'Create Excel object
    Set xlBook = CreateObject("Excel.Sheet")
    'Put data 
    xlBook.Sheets(1).Cells(1, 1).Value = "Test"
    xlBook.Sheets(1).Cells(1, 2).Value = "Data"
    xlBook.Sheets(1).Cells(1, 3).Value = Now()
    'Disable overwrite confirmation prompt
    xlBook.Application.DisplayAlerts = False
    'Save Excel book
    xlBook.SaveAs FileName:="C:\Program Files\Admin folder\test.xls"
    End Sub

Posting Permissions

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