File not Found: TM1api.dll (When running VB script - runtime error 53)

Post Reply
thush_CMB
Posts: 3
Joined: Wed Mar 08, 2017 11:00 pm
OLAP Product: TM1
Version: 10.2.2 FP5
Excel Version: 2010 32bit

File not Found: TM1api.dll (When running VB script - runtime error 53)

Post by thush_CMB »

Hi All,

I encountered an issue while running an VB script to refresh and send out an automated report.
When i debug, cursor stop at 'TM1APIInitialize' in the TM1api BAS file.

server : windows 2008 R2
TM1 version : 10.2.2 FP5
excel : office 2010 32 bit

However when i set the excel 'Application.visible = True' in the script , it does not throw an error.

But, i would like to run this script automatically via windows scheduler when user is not logged on or not.

excel setting : "Application.visible = False"
VB script error
VB script error
error_1.PNG (2.61 KiB) Viewed 2428 times
debug screen
debug screen
error_2.PNG (16.4 KiB) Viewed 2428 times
Any advise to fix the issue?
Alan Kirk
Site Admin
Posts: 6647
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: File not Found: TM1api.dll (When running VB script - runtime error 53)

Post by Alan Kirk »

I haven't tried to use the API with VBScript (and I don't think you are either; see the last paragraph) but it's dollars to donuts that it has to do with the path to the files not being included correctly in the %PATH% environment variable. This is complicated by the fact that IBM has changed the install path something like 4 frapping times in 5 frapping versions, and that unlike some programs it does not clean up its own merde by updating the Path environment variable upon installation. But hey, the damn thing can't even uninstall a previous version, so...

The issue of setting the path is discussed in chapter 1 of the API Guide if you have the .pdf; if you don't, download it because you'll need it.

I've taken only the most cursory glance at your code but one thing leaps out; if you want this to be standalone code you cannot use TM1_API2HAN. That is only for code that is written in VBA in Excel, and it's for piggy-backing on the user's existing Perspectives connection so that they don't have to log in every time they want to call some VBA API code. Officially the function is unsupported as IBM Support told me when I tried to get it added to the API manual (don't get me started...), but anyone writing VBA code still uses it anyway. However if you're writing it outside of VBA in Excel[1] you need to get the user handle from the TM1SystemOpen function.

(Unless you actually mean VBA and not VBScript - they are not the same thing - which is what it looks like from your code. In any case it won't work if you want to run the thing unattended since TM1_API2HAN depends on (a) a session of Excel running and (b) a user being logged into TM1 inside that session.)

----------------------------
[1]No, you can't use it in Access or Word VBA either.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
Post Reply