Results 1 to 12 of 12

Thread: Using CreateObject to.... Read More

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Posts
    219
    CreateObject function can be used to activate applications on a server. Has anyone successfully done this?

  2. #2
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    Yes

    All it means is that you can use VB to start an ActiveX application and thereby "remote control" it as it were.

    I use it in one app to create Word documents once the user has finished capturing and annotating video images.

    You'll find that many of the Microsoft apps are available as activeX servers.

    If you want to use activeX servers on another system (in case this is what you mean by "server") then this is also possible but alas I have not had need to try it. This ought to be just the same as if it is on your computer because as I understand it, this is what the COM provides.

    Let me know if you want more info on running word from VB code (no controls).

    Regards
    Paul Lewis

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    You can start a server application on a remote computer using CreateObject. Just pass the computer name as the second argument.
    You have do have DCOM98 installed though.
    You can never however show the application that you have started this way. So the Visible property has no effect.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Posts
    219
    Thanks both.

    Can you pls give me sample code which demonstrates how to do this?

  5. #5
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Code:
    Dim xl As Object 'or Excel.Application if you have a reference
    Set xl = CreateObject("Excel.Application", "RemoteComputerName")

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Posts
    219
    Can the RemoteComputerName be the name of any computer in the network?

  7. #7
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Yes as long as it got DCOM installed.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Posts
    219
    Tell me more about DCOM. How do I get it?

  9. #9
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    DCOM is included in WinNT, Win98 and Win2K. If you have Win95 you should have it anyway because Visual Studio won't install without it.
    Otherwise you can download from Microsoft at:
    http://www.microsoft.com/com/resources/downloads.asp

    Good luck!

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Posts
    219
    It does not work. An error occurs:
    Run-time error '462'
    The remote server machine does not exist or is unavailable

  11. #11
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Try
    Code:
    Set xl = CreateObject("Excel.Application", "\\RemoteComputerName")
    If the remote computer isn't a WinNT or Win2000 machine someone must log on the computer for it to work!

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Posts
    219
    Still no good.
    But it works when RemoteComputerName = the name of the local computer name.

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