SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Member
    Join Date
    Aug 2008
    Posts
    45
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Excel message displayed while trying to write

    Hi,

    I am using the below scripting for writing into the excel sheet.

    set objExcel = createobject ("Excel.Application")
    objExcel.workbooks.open "C:\Users\Ram\Desktop\ram.xls"
    'objExcel.Visible = True
    set xlsheet = objExcel.sheets.Item(1)
    roww = 1
    coll = 2

    For i=0 to 2
    'Do so and so
    ' here i fetch the value in a variable called Var1 and write the value of Var1 into the excel sheet
    xlsheet.Cells(roww+i, coll).Value = Var1

    Next
    objExcel.Save
    objExcel.Quit
    set xlsheet=nothing
    set objExcel=nothing


    While executing the above script, when my script reaches the line objExcel.Save, i have been displayed with a message stating "A file named 'RESUME.XLW' already exists in this location. Do you want to replace it?"

    Note: My script doesnt have any code to create the above xlw file.
    I have searched in my PC, there is a file called RESUME.XLW. So i have deleted the RESUME.XLW file and ran my script. It works fine.
    For confirmation i tried to run it again but again the same old message stating "A file named 'RESUME.XLW' already exists in this location. Do you want to replace it?".

    So to work it, i should keep deleting the above file on every second instance.

    Could anyone let me know how to handle the above issue.

    Waiting for your reply.

  2. #2
    Moderator ifraser's Avatar
    Join Date
    Jul 2004
    Location
    Brisbane, Australia
    Posts
    2,090
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Excel message displayed while trying to write

    Make the workbook a shared document
    You can buy my Art from: "Post Cards now available"
    Ian Fraser Landscape Photography
    World Wide Shipping.

    http://mowogman.wordpress.com/

  3. #3
    Member
    Join Date
    Oct 2006
    Posts
    82
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Excel message displayed while trying to write

    try using below code instead of "objExcel.Save"
    objExcel.Workbook.save

    Hope this will work. It worked for me a long back and please let me know if it is working now.

  4. #4
    Apprentice
    Join Date
    Jul 2006
    Posts
    43
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Excel message displayed while trying to write

    Try this
    appExcel.ActiveWorkbook.SaveAs strfilepath&".xls",-4143

  5. #5
    Member
    Join Date
    Aug 2008
    Posts
    45
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Excel message displayed while trying to write

    Hi,

    I have tried using objExcel.Workbook.save instead of objExcel.Save.

    I have been displayed with a message stating "Object doesnt support this property or method: 'objExcel.Workbook'.

  6. #6
    Member
    Join Date
    Aug 2008
    Posts
    45
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Excel message displayed while trying to write

    Hi,

    I am interested in saving the data in the same file rather than creating new file.

  7. #7
    Member
    Join Date
    Aug 2008
    Posts
    45
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Excel message displayed while trying to write

    I tried sharing the workbook but it shows me the same error message "Resume.XLW" already exists.

  8. #8
    Junior Member
    Join Date
    Dec 2006
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Excel message displayed while trying to write

    objExcel.DisplayAlerts =False
    objWorkBook.SaveAs strTestResultsRoot&"\"&WorkBook& ".xls"
    objExcel.DisplayAlerts =True

  9. #9
    Apprentice
    Join Date
    Jul 2006
    Posts
    43
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Excel message displayed while trying to write


  10. #10
    Member
    Join Date
    Aug 2008
    Posts
    45
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Excel message displayed while trying to write

    Hi Feby,

    Your script solves my problem. Thanks for the same.

 

 
Page 1 of 2 12 LastLast

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 Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 9.38%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 07:53 PM.

Copyright BetaSoft Inc.