SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    Advanced Member
    Join Date
    Oct 2010
    Location
    USA
    Posts
    578
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    xlread is failing to read data from excel !


    The script below for xlread is failing to read data from excel
    error thrown : "unexpected end of the statement "
    please let me know the solution .

    Dim xpath,xobj,xrow

    xpath ="C:\Users\hp\Documents\try.xls"
    xsh="data"

    xrow=1
    'xcol=1

    'open the excel appln
    Set xobj=createobject ("Excel.Application")

    'open the sheet
    xobj.workbooks.open xpath

    'make it visible
    xobj.application.visible=true

    set xshee=xobj,activeworkbook.worksheets(xsh)


    do while xsheet.cells(xrow,1)<>""
    print xsheet.cells (xrow,1) & "" xsheet.cells (xrow,2) & ""
    xsheet.cells (xrow,3)
    xrow=xrow+1
    loop


    xobj.ActiveWorkbook.Close

  2. #2
    Moderator
    Join Date
    Oct 2010
    Location
    Norway
    Posts
    3,265
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0

    Re: xlread is failing to read data from excel !

    Not sure of what you are trying. But there are snytax errors & incorrect references in the above statements.

    Try the code below.

    Dim xpath,xobj,xrow

    xpath ="C:\Users\hp\Documents\try.xls"
    xsh="data"

    xrow=1
    'xcol=1

    'open the excel appln
    Set xobj=createobject ("Excel.Application")

    'open the sheet
    xobj.workbooks.open xpath

    'make it visible
    xobj.application.visible=true

    set xsheet=xobj.activeworkbook.worksheets(xsh)


    do while xsheet.cells(xrow,1)<>""
    print xsheet.cells (xrow,1) &" " & xsheet.cells (xrow,2) & " " & xsheet.cells (xrow,3)
    xrow=xrow+1
    loop


    xobj.ActiveWorkbook.Close
    Rajkumar

  3. #3
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: xlread is failing to read data from excel !

    Oceans, whenever you post code with errors always point out the location where the error has occured

 

 

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 11.54%
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 08:04 PM.

Copyright BetaSoft Inc.