Results 1 to 1 of 1
  1. #1
    Join Date
    Jul 2003

    Unanswered: ASP - Writing to Excel Problem

    Ok, so I have an excel file on my webserver and I want to write
    certain data to it. I'm using ASP, VBScript and IIS on a W2k Server.

    Here are my steps:
    1) Copy file "A" from a directory to directory B as "A1".
    2) Open file "A1" and write data to certain cells.
    3) Close Excel file.

    The main problem is, it copies the file, writes the data, BUT
    it makes two files... file "A1" which is the one I want and
    another file "8B18300" or any other random name. WHY does it
    make this other file? Is it the way I'm using the excel.Application
    object? Also, sometimes, the data doesn't get written to my file
    "A1", but if I open the randomly named file, the data is there.

    SO, 2 questions:
    1) why does it create this random file?
    2) why does the data always get written to the random file,
    and not my written file?

    Thanks for any help, my basic code is included below:

    I used the following code:

    ----------- BEGIN CODE -----------

    dim objFSO, objExcel, objWorkBook, src, dest

    Set objFSO = Server.CreateObject("scripting.filesystemobject")
    objFSO.copyfile src, dest

    set objExcel = CreateObject("Excel.Application")

    objExcel.Visible = false
    objExcel.DisplayAlerts = false


    objExcel.ActiveSheet.Range("C3").Value = "HI"

    objExcel.ActiveSheet.Range("E1:E1").Value = "Name"
    objExcel.ActiveSheet.Range("F1:F1").Value = "Desc"


    set objExcel = Nothing
    Set objFSO = Nothing

    ----------- END CODE -----------
    Last edited by robg69; 04-08-04 at 20:22.

Posting Permissions

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