SPONSORS:






User Tag List

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

    unable to add sheet to the excel object

    Hi

    unable to add sheet

    code
    Set ExcelObj = CreateObject("Excel.Application")
    ExcelObj.Visible = TRUE
    ExcelObj.Workbooks.Add
    ExcelObj.ActiveWorkbook.Worksheets.Add (After:=Worksheets(Worksheets.Count)).Name = "MySheet"
    Msgbox ExcelObj.WorkSheets.Count
    ExcelObj.Quit
    Set ExcelObj = Nothing

    Help

  2. #2
    Member
    Join Date
    May 2007
    Posts
    90
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: unable to add sheet to the excel object

    at any position we are able to add but our scenario is to add the sheet at the end of the default three sheets

  3. #3
    SQA Knight
    Join Date
    Jul 1999
    Location
    Grand Rapids, MI
    Posts
    3,727
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: unable to add sheet to the excel object

    Search the forum! I would be a rich man if I had a quarter for each thread that this and related questions.

    SEARCH first, POST second.

    Here is at least one hit from an Advanced Search using the syntax:

    +add +sheet

    http://www.sqaforums.com/showflat.ph...;Number=415063

    P.S. The above thead shows how to add a sheet to a data table. I see now the questions is about generic Excel Object automation. I would suggest you refer to Excel automation documentation for that answer, if this has not previously been asked and answered on this forum.



  4. #4
    Senior Member
    Join Date
    Oct 2005
    Location
    London, U.K
    Posts
    1,804
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: unable to add sheet to the excel object

    Refering to excel automation documnetation will not help much here, as the question is really how to use Excel COM in vbscript.

    Main thing to remember is that you can not use excel constants and you can not use excel object names.

    So for your problem :

    Set ExcelObj = CreateObject("Excel.Application")
    ExcelObj.Visible = TRUE
    ExcelObj.Workbooks.Add
    ExcelObj.ActiveWorkbook.Worksheets.Add ,Excelobj.sheets(Excelobj.Worksheets.Count),,-4167 'expression.Add(Before, After, Count, Type)
    Msgbox ExcelObj.WorkSheets.Count
    ExcelObj.Quit
    Set ExcelObj = Nothing

  5. #5
    SQA Knight
    Join Date
    Jul 1999
    Location
    Grand Rapids, MI
    Posts
    3,727
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: unable to add sheet to the excel object

    [ QUOTE ]
    Refering to excel automation documnetation will not help much here, as the question is really how to use Excel COM in vbscript.


    [/ QUOTE ]

    Excel automation and Excel COM are one and the same.

  6. #6
    Senior Member
    Join Date
    Oct 2005
    Location
    London, U.K
    Posts
    1,804
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: unable to add sheet to the excel object

    Not sure your point Terry?

    Do you mean by excel help 'excel automation documnetation'. You won't find how to use excel from vbscript in there.

  7. #7
    SQA Knight
    Join Date
    Jul 1999
    Location
    Grand Rapids, MI
    Posts
    3,727
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: unable to add sheet to the excel object

    [ QUOTE ]
    Not sure your point Terry?


    [/ QUOTE ]
    That is abundantly clear in this and many other threads. You have provided a good response to the posters issue, so lets just move on.

  8. #8
    Member
    Join Date
    May 2007
    Posts
    90
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: unable to add sheet to the excel object

    Thanks A lot to Turbografx,Terry it works terribly

    It works fine can u please do let me know where can i find the 'excel automation documnetation'

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

  10. #10
    Member
    Join Date
    May 2007
    Posts
    90
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: unable to add sheet to the excel object

    sorry tarun the specified links does not provide the info regarding the Excel Automation Documentation

 

 
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 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 02:13 PM.

Copyright BetaSoft Inc.