Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to include COM object in Attachmate Macro 1

Status
Not open for further replies.

vivagupta

Technical User
May 9, 2006
7
IN
Hi all

This may be a newbie question. Could someone help me understand how does Attachmate support including external libraries like DLL/CAB files as part of their macros? I need to include a CAB file of external application within the macro so that i can call the external API from within the Attachmate macro.

I am able to include the CAB file in Tools> References when running the macro from Excel VB. But there is no such option available using Macro Editor of Attachmate.

Any quick inputs on this will be highly appreciable.

Thanks,
Viva.
 
Any reason not to just run it through Excel?
 
I was using excel only to quickly test out my code. But the code has to be plugged into an attachmate macro so that it can be invoked from attachmate screens.
 
What api are you wanting to use? Here's an example using the shell32.dll

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal HWND As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long


Sub subNewShell(strFileToOpen As String)
Dim lngReturn As Long
lngReturn = ShellExecute(0, "open", strFileToOpen, "", "", 1)
End Sub

Sub Main()
Call subNewShell("C:\test.xls")
End Sub

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
Its a Siebel API that uses Siebel ActiveX Control. I have written code using this control and it works fine in VB coz i just reference out the control. But in EB i am not sure how do i include this control. Can we declare a custom DLL the way you have declared shell32.dll in your example, and then use it in an EB macro?

- Viva
 
Post your VB code declaring and calling the API and I'll see if I can help.

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
For starters you need to use "" in place of vbNullString for Extra Basic.

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
Dim siebApp As SiebelHTMLApplication
Dim siebSvcs As SiebelService
Set siebApp = GetObject("", "Siebel.Desktop_Integration_Application.1")
Set siebSvcs = siebApp.GetService("Pre Notification CA")
 
Hey, one more question - the macro first opens an IE window using shell command and connects to an HTTP URL. What i am trying to do is, if the IE window is already open with the same HTTP URL, then the macro should simply connect to that window rather than opening a new window. Any suggestions for doing this in EB???
 
2nd question answered in thread1-1226885.

Try this for the first

Dim siebApp As Object
Dim siebSvcs As Object
Set siebApp = GetObject("Siebel.Desktop_Integration_Application.1")
Set siebSvcs = siebApp.GetService("Pre Notification CA")

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
Both worked!!!! Thanks a lot for your timely help!!! out of curiosity, is there no way that i can include VB code into EB macro??? Do i need to make changes to VB code whenever i am trying to move it to EB?

And hey, i searched a lot on disabling minimize button on an IE window using VB/EB. Couldnt find anything concrete. Do you know if this is straight forward stuff?
 
Never tried it but check CautionMP's post in thread1-1210595.

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
Most VB will drop into EB with little or no change. Here are some other Forums to add to your Threadminder that will help.

forum99 - Another Attachmate Forum with EB examples
forum707 - VBA
forum222 - VB 5&6

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top