Launch BO Classic from VBS file + Refresh

I’m developing a reporting environment and make use of MS Access, SAS and BO (because of different reasons/politics)…they don’t allow me to use Designer, so all output comes is delivered from SAS in .xls files. Based on the .xls files I created some reports.

Question:

Can I launch BO Classic 6.5 from a VBS file and refresh some of the reports automatically in VBA…I assume the latter shouldn’t be a problem but has anyone experience with launching BO from a .vbs file?

please as much info as possible

regards


MichM3 (BOB member since 2005-06-07)

search is your friend:
https://bobj-board.org/t/60258

The only thing to do there is change the code from pure VB to VBS
(ie: Dim boDoc As busobj.Document
to Dim boDoc As Object)

Regards,

Gerard


highandstoned :netherlands: (BOB member since 2005-08-01)

hey thanks a lot…this will help me out…great! :smiley:


MichM3 (BOB member since 2005-06-07)

Hi,

problem…I’m writing the .VBS file and I’m having an error at the line where I’m going to login:

Dim bo, Path, SavePath

Usrnm = "user" 
Pswrd = "password" 
RepoName = "BOMAIN" 

Path = "H:\My Business Objects Documents\userDocs" 
SavePath = "C:\Dummy\" 

Set bo = CreateObject("BusinessObjects.Application") 

bo.LoginAs Usrnm, Pswrd, False, RepoName 

The error is: “The remote server machine is uninitialized or doesn’t exist ‘LoginAs’”

What could be the problem? Am I using the wrong code?

Secondly, small remark…When launching Business Objetcs from Windows, we don’t have to login…the login screen doesn’t popup, the application is opened immediately. Although there’s a BoMain.key file on the machine so I assume the login is detected by NT authentication…Is the code for Login in by VBS different in this case?

regards


MichM3 (BOB member since 2005-06-07)

pehaps you don’t have to login, try this code (it makes BO visible, so you can see if it’s already logged in)


Dim bo, Path, SavePath 

Usrnm = "user" 
Pswrd = "password" 
RepoName = "BOMAIN" 

Path = "H:\My Business Objects Documents\userDocs" 
SavePath = "C:\Dummy\" 

Set bo = CreateObject("BusinessObjects.Application") 
bo.Visible = True 

highandstoned :netherlands: (BOB member since 2005-08-01)

Hi,

I tried the code you suggested but I receive again the same error:

The error is: “The remote server machine is uninitialized or doesn’t exist ‘Visible’”

…there is definitely a step missing, but I don’t know what… :frowning:


MichM3 (BOB member since 2005-06-07)

I do suppose BO full client is installed on the machine you’re running this VBS code on?

Problem is I’m sick home now, so can’t test anything, but it sounds like it doesn’t want to create the BO application.

Can yoou try this:


Dim bo, Path, SavePath 

Usrnm = "user" 
Pswrd = "password" 
RepoName = "BOMAIN" 

Path = "H:\My Business Objects Documents\userDocs" 
SavePath = "C:\Dummy\" 

Set bo = CreateObject("BusinessObjects.Application") 
msgbox IsObject(bo)

Can you create any other application with vbs on this machine ?
Somethine like:


Set bo = CreateObject("Excel.Application") 
msgbox IsObject(bo)

Regards,

Gerard


highandstoned :netherlands: (BOB member since 2005-08-01)

Yes that works…it returns “True” and in my Task Manager I can see MS Excel joining the list of processes.

On the other hand, I decided to start up Business Objects from MS Access, so I can use VBA for this…I wrote a Sub and it’s already working. No need to suffer this VBS issue anymore…

Although for the challenge I’d be happy search further…maybe when you’ve recovered from beiing sick? :lol:

Take care and thanks for helping!

regards,

Mich


MichM3 (BOB member since 2005-06-07)

Hmm, weird. So it works from VBA but not from VBS.

I’ll try that next week when I’m hopefully recoverd.

Regards,

Gerard


highandstoned :netherlands: (BOB member since 2005-08-01)

yes that’s true…it works from VBA and not from VBS…

…of course, it didn’t work from the first time in VBA neither, as I had to add my BO Objects Library 6.5 Reference…after this it worked perfect.
…is there something like this that has to be added/defined using VBS? Maybe we have to search in that area…I’m certainly not a VBS-expert… :oops: …excuse me when I’m saying stupid things…

We’ll come to that again next week…thanks!


MichM3 (BOB member since 2005-06-07)

no, it’s not a reference. You can’t add a reference in VBS (and no shame in not knowing VBS. Since you know VBA, you know VB, VBA,VBS,WSH and ASP since they’re basicly the same language just with some restrictions and variations)
But did you copy exactly this script in VBA ?
Of did you (since you added the reference which isn’t necessary when you use createobject()) use this sort of code:


dim bo as busobj.application
set bo = new busobj.application

Regards,

Gerard


highandstoned :netherlands: (BOB member since 2005-08-01)

Hi,

just tried this code in vbs:


Set bo = CreateObject("BusinessObjects.Application") 
bo.Visible=TRue

and it gave me no errors…
Do you have more versions of BO installed on this machine ? If so, you can also try:


Set bo = CreateObject("BusinessObjects.Application.6") 
bo.Visible=TRue

Otherwise…I wouldn’t know since it works from VBA…

Regards,

Gerard


highandstoned :netherlands: (BOB member since 2005-08-01)

…doesn’t work

dim bo

Set bo = CreateObject("BusinessObjects.Application.6") 
bo.Visible=TRue 

…this code returns following error:

“The object invoked has diconnected from its clients”

This code

dim bo as busobj.application 

always returns an error on my machine…“Expected end of statement”…it has something to do with the “as”. When I just put “Dim bo” without “as” the error disappears :?


MichM3 (BOB member since 2005-06-07)

In VBS you don’t declare the type of variable (the as part), it’s determined at runtime what type it is.

For the error message…I don’t know what it is since you could start excel didn’t you ?


dim bo 

Set bo = CreateObject("Excel.Application") 
bo.Visible=TRue 

You could also try if designer (Designer.Application) does work from VBS, but it doesn’t solve the problem. Only thing I can think of is that there’s something wrong with your installation and windows can’t associate the ‘BusinessObjects.Application’ with the correct type library (tlb). If you run it from VBA you set the reference at the start so it doesn’t need to find it.

Regards,

Gerard


highandstoned :netherlands: (BOB member since 2005-08-01)

yes I suppose you’re right :wink:

…indeed I could start up Excel without problems. The same code for BO results in an ERROR…there have been serious troubles here with BO lately so I assume there’s something wrong with installations…In december they migrated from 6.1 to 6.5.

Anyway, I’m going to leave it by this…I’m using VBA to start up BO and it’s working so I don’t need this VBS solution anymore. Would be a waste of time now on my spooky pc :wink:

…thanks for the help…great!

Mich


MichM3 (BOB member since 2005-06-07)