Results 1 to 9 of 9

Thread: Iterating the ROT !

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2005
    Posts
    43

    Iterating the ROT !

    Any idea how to iterate the ROT (Running Objects Table) using the API ?

    Thanks.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Iterating the ROT !

    I do understand the "Running Objects Table"

    Are you referring to the currently running processes?

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2005
    Posts
    43

    Re: Iterating the ROT !

    Quote Originally Posted by Hack
    I do understand the "Running Objects Table"

    Are you referring to the currently running processes?
    Yes. but I want to connect to those processes so I can automate them.

    Regards.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Iterating the ROT !

    Quote Originally Posted by BLUE_SEA
    Yes. but I want to connect to those processes so I can automate them.

    Regards.
    Ok, I have examples of how to list out what is currently running, but I'm not sure what you mean by "automate" them.

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Iterating the ROT !

    Why would you want to "automate" running processes? You can enumerate the running processes and optionally terminate one.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6

    Thread Starter
    Member
    Join Date
    Dec 2005
    Posts
    43

    Re: Iterating the ROT !

    Thanks.

    I need to get all the running Excel Applications and be able to retrieve and set the cell values in their respective open workbooks via code.

    Something similar to the GetObject Method but without having to provide the open workbook path.

    I have managed this via the use of a third party DLL but I am wondering if this can be done through the use of APIs from scratch to make my project more portable.

    Regards.

  7. #7
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Iterating the ROT !

    Now that we know what you want:

    You can use the getObject method for what you want to do. Nothing to with with API however.
    VB Code:
    1. Dim oXLApp As Excel.Application
    2. Dim oXLwb As Excel.Workbook
    3. Dim oXLsheet As Excel.Worksheet
    4.  
    5.     Set oXLApp = GetObject(, "Excel.Application")
    6.     'get each open workbook
    7.     For Each oXLwb In oXLApp.Workbooks
    8.         Debug.Print oXLwb.Name
    9.         'get each worksheet in each open workbook
    10.         For Each oXLsheet In oXLwb.Worksheets
    11.             Debug.Print vbTab; oXLsheet.Name
    12.         Next
    13.     Next
    See Si's excellent tutorial
    http://www.vbforums.com/showthread.php?t=391665

  8. #8

    Thread Starter
    Member
    Join Date
    Dec 2005
    Posts
    43

    Re: Iterating the ROT !

    Quote Originally Posted by moeur
    Now that we know what you want:

    You can use the getObject method for what you want to do. Nothing to with with API however.
    VB Code:
    1. Dim oXLApp As Excel.Application
    2. Dim oXLwb As Excel.Workbook
    3. Dim oXLsheet As Excel.Worksheet
    4.  
    5.     Set oXLApp = GetObject(, "Excel.Application")
    6.     'get each open workbook
    7.     For Each oXLwb In oXLApp.Workbooks
    8.         Debug.Print oXLwb.Name
    9.         'get each worksheet in each open workbook
    10.         For Each oXLsheet In oXLwb.Worksheets
    11.             Debug.Print vbTab; oXLsheet.Name
    12.         Next
    13.     Next
    See Si's excellent tutorial
    http://www.vbforums.com/showthread.php?t=391665

    Thanks moeur BUT that only works accuratly if there is ONE XL app running.

    You are out of luck if there are more than one XL instance.

    I want to be able to retrieve all the running XL apps.

    Any ideas ?

  9. #9
    New Member
    Join Date
    Jun 2006
    Location
    Texas
    Posts
    2

    Re: Iterating the ROT !

    I had a similiar need at work recently. As a result I put together the following solution in the attached zip file, which I'm using in 2 projects so far at work. You'll find 4 drivers and 1 VB6 wrapper class. The main driver to use is 'olelib.tlb,' which should be placed in either the Windows\System or WINNT\System32 folder. The wrapper class's public procedures should allow you to easily return the ROT's open Excel, PowerPoint, and Word path/filenames and, *most* importantly, the Presentation, Document, and Workbook objects in a 2D array. For example, arr(0, x) will be the path/filename and arr(1,x) will be either be the corresponding Presentation, Document, or Workbook object. See the README.txt, too. It has a good bit more detail. Hope that helps.
    Attached Files Attached Files

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