Results 1 to 3 of 3

Thread: Excel+ASP - Document not saved error help!!

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2002
    Location
    India
    Posts
    50

    Excel+ASP - Document not saved error help!!

    I use the following code to copy a file on the root folder, in an ASP page:

    Set fso = CreateObject("Scripting.FileSystemObject")
    Set MyFile = fso.GetFile(Server.MapPath("OldFile.xls"))
    newFileName = "NewFile_" & datepart("m", now()) & "_" & datepart("yyyy", now()) & "_" & datepart("s", now()) & ".xls"
    MyFile.Copy (Server.MapPath(newFileName))

    This works fine.
    But then I use the Excel library to open the file, add some rows, and then save it, when I get the Document Not saved Error.

    Code to open excel file:
    Set oXL = CreateObject("Excel.Application")
    Set oWB = oXL.Workbooks.Open(Server.MapPath(newFileName))
    Set oWS = oWB.Worksheets("Sheet2")

    Code to save and close the Excel file:
    Set oWS = Nothing
    oWB.Save
    oWB.Close False
    Set oWB = Nothing
    oXL.Quit
    Set oXL = Nothing


    Please help me out!! How do I get rid of this error? Is it a permissions problem? Does the XL library lock the file???

  2. #2

    Thread Starter
    Member
    Join Date
    Jan 2002
    Location
    India
    Posts
    50
    BUZZZZZ

    PLEASE Help!! I really need to solve this problem!!!!!

  3. #3
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    Have you checked the permissions on the copied file? It could be that it doesnt have write permission after its being copied.
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

Posting Permissions

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



Click Here to Expand Forum to Full Width