3
votes

On window 10 machine that has visual studio 6 SP 6, visual studio 2102 and visual studio 2015, I'm unable to retrieve an instance of object from running object table when code is executed from Visual studio 6 IDE.

I'm running vb6 as administrator and invoking following VB call:

Set SapGuiAuto = GetObject("SAPGUI")

I'm getting following error:

Automation error , Invalid syntax

Strangely, when same code is invoked from the executable, i'm getting instance of object and desired results. The error occurring on any ‘GetObject’ function call from VB6 IDE. There are no compilation error and when same code executed from executable there are no error either. However, unable to proceeds when invoked from IDE. I had used this function call many times previously and it even work on windows 10 but now unable to debug any vb6 application that uses 'GetFunction' method.

On same machine i also have Visual studio 2015 and visual studio 2012. The only change that i can recall is installation of Visual studio 2012.

2

2 Answers

3
votes

To be able to access out-of-process COM servers both client and server has to be run under the same integrity level, i.e. if client (VB6) is elevated then server (SAPGUI) has to be elevated too and the same if client is not elevated -- server should not be elevated too.

Try to start SAPGUI executable as administrator first, before starting debug session in VB6 IDE.

1
votes

Try this:

Set SapGuiAuto = GetObject(,"SAPGUI")

GetObject has an optional parameter and sometimes it needs a hint...