API Robot - Excel VBA Error - Runtime error - 2147024769 (8007007f)

API Robot - Excel VBA Error - Runtime error - 2147024769 (8007007f)

darren.cosh
Participant Participant
2,611 Views
11 Replies
Message 1 of 12

API Robot - Excel VBA Error - Runtime error - 2147024769 (8007007f)

darren.cosh
Participant
Participant

Hello,

 

I am student and I am working on a project with a company. I came to a dead end and I need help with VBA.

 

Basically what I am doing is I have the model ready and done all calculations by the regular GUI. I want to extract the results and calculations such as the displacement, node locations and stiffnesses of springs onto the excel sheet for manipulation and interpretation. Further I need to enter the data into another geotechnical software based on the coordinates. I have the excel macros setup and these macros are previously tested so the syntax is correct. 

 

The issue is arising when I run the macro to pick data and enter into excel. Robot is open when I use the macros and the Object model (robotom.tlb), Kernel(Kernelom.tlb) reference are already added to excel, SDK is installed as well. I get the attached run-time error when using VBA. I have also attached the command which shows error when running. 

 

The explicit error I am getting is 'Method Project of object 'IRobotApplication' failed'. Not fully sure but the object file should connect to excel and pick up data. 

 

Further there are two instances of files for the Object model (robotom.tlb), one is with the exe directory and one is within the SDK directory, can these conflict with one another? Although I have only added the Object model file of exe as reference in VBA excel. 

 

I get the same error when using the tutorial macros available in SDK files for version 2022. The references added in excel are for version 2022, which is the same version I have the model open. Although version 2023 is also installed onto the same system.

 

When running Robot, I have no errors during the calculation. Further, the installation of the software seems fine as well. Please help me! 

0 Likes
Accepted solutions (1)
2,612 Views
11 Replies
Replies (11)
Message 2 of 12

Stephane.kapetanovic
Mentor
Mentor

hi @darren.cosh 

First go to VBA editor and select <Tools> <Preferences> and search for "Robot Object Model ver. 23.0".

It is important that robot and a project are open
Then restart your scripts

Best Regards

Dim RobApp As RobotApplication
Set RobApp = New RobotApplication
NotReady = Not (RobApp.Visible = -1 And RobApp.Project.IsActive = -1)
If NotReady Then
  Set RobApp = Nothing: Exit Sub
End If

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to accept the solution and leave a < like !
EESignature
0 Likes
Message 3 of 12

darren.cosh
Participant
Participant

The version I have opened and made the model on is 2022, so I have used 'Robot Object Model ver. 22.0'. In the VBA editor <Tools> <Preferences> and search for "Robot Object Model ver. 23.0" doesn't show, only I can see the Kernal file for ver. 23.0. Shouldn't the software version match with the version of object and kernel?

 

Further, I tested the SDK example again. When keeping robot exe closed, I ran the Tower Generation example taken from SDK , and the macro worked when using Excel VBA with 2022 version of software and Object files as references. I get the error mentioned previously when I have the Robot model open, using the visible command and then it gives run-time error when I access the data for calculations-node points to be transferred into excel. 

 

Thanks

0 Likes
Message 4 of 12

darren.cosh
Participant
Participant

Hi @Stephane.kapetanovic 

 

The version I have opened and made the model on is 2022, so I have used 'Robot Object Model ver. 22.0'. In the VBA editor <Tools> <Preferences> and search for "Robot Object Model ver. 23.0" doesn't show, only I can see the Kernal file for ver. 23.0. Shouldn't the software version match with the version of object and kernel?

 

Further, I tested the SDK example again. When keeping robot exe closed, I ran the Tower Generation example taken from SDK , and the macro worked when using Excel VBA with 2022 version of software and Object files as references. I get the error mentioned previously when I have the Robot model open, using the visible command and then it gives run-time error when I access the data for calculations-node points to be transferred into excel. 

 

Thanks

0 Likes
Message 5 of 12

Stephane.kapetanovic
Mentor
Mentor

hi @darren.cosh 

if the 2022 license is active, ok, that is enough. Leave the kernel unchecked it will not be useful

if RobotOM is loaded and Robot is open with an open project, there is no reason for your program (Code Snippet) to stop.

The Tower_generation.xls program starts by launching Robot if it is not open. It's a different code than yours so I'm not surprised to see it working even if "Code Snippet" stops.

To go further, I need the lines of your code up to the one that caused the error. Don't forget to mention it and provide a snapshot like you did. If a project related to your code is open you can attach it too.

Best Regards

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to accept the solution and leave a < like !
EESignature
0 Likes
Message 6 of 12

darren.cosh
Participant
Participant

Hi @Stephane.kapetanovic 

 

I have attached a screenshot of the code, the yellow mark is where the code doesn't run and the error is shown. Globally the arrays and objects are declared as Public (also included a snippet of this code in my first message). 

 

Also attached the ROBOT modelled on 2022 version as a snippet as well. This is always open when I run the code, the analysis runs without any errors.  The email box would not allow me to upload .rtd files. 

 

Thanks,

0 Likes
Message 7 of 12

Romanich
Mentor
Mentor

Hi @darren.cosh ,

 

Try to comment the marked section and run your code:

Romanich_0-1692889727155.png

 

Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.

Roman Zhelezniak

Robot Evangelist & Passionate Civil Structural Engineer

LinkedIn | Robot & Хобот | App Store for Robot
EESignature


0 Likes
Message 8 of 12

darren.cosh
Participant
Participant

Hi @Romanich 

 

I tried what you asked but then I get the same error on the next line where RobApp.Project is called. 

 

Are there settings inside the GUI I can access and see what is happening line by line and debug this?

 

Thanks,

0 Likes
Message 9 of 12

Stephane.kapetanovic
Mentor
Mentor

hi @darren.cosh 

try this beginning for your code.

Stephanekapetanovic_1-1692892095848.png

Best Regards

 

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to accept the solution and leave a < like !
EESignature
0 Likes
Message 10 of 12

darren.cosh
Participant
Participant

Hi @Stephane.kapetanovic 

 

I used the code provided by you, had to declare 'NotReady' in the start so that there is no compiler error.

 

I have attached the debugger, showing the line making the same error again 'Runtime error - 2147024769 (8007007f)'. Can there be an issue with the complier being used by excel to execute the code?

 

Thanks

0 Likes
Message 11 of 12

Stephane.kapetanovic
Mentor
Mentor
Accepted solution

hi @darren.cosh 

ok, I understand that the instance is not created. Try reinstalling the SDK 2022 or run your 2023 and test again.

change the definition of NotReady like this ↓ and tell me the result on Visible and ProjectActive

 

Visible = RobApp.Visible = -1
ProjectActive = RobApp.Project.IsActive = -1
NotReady = Not (Visible And ProjectActive)

 

Best Regards

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to accept the solution and leave a < like !
EESignature
0 Likes
Message 12 of 12

darren.cosh
Participant
Participant

Hi @Stephane.kapetanovic 

I reinstalled and now the original code is working fine. 

Thanks,