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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to access unknown APIs in Access?

Status
Not open for further replies.

jumpjack

Programmer
Jul 28, 2006
79
IT
I'm quite new to API programming from within Access in VBA, so it's not yet clear to me how to access an external library using CREATEOBJECT or similar: at this moment, I can just copy&paste some code I find around and tune it.

Browsing around available references in Access I found some interesting libraries I'd like to examine, as they could be useful to manage my phone from PC:
Motorola MPSDRC tpe lib 1.0
Motorola Email Message Centre Typelib...
Motorola ContProSap tpe lib 1.0

How can I now how they can be used? By pressing F2 from within a code window I can see all methods and properties exposed by those libraries.... but I miss the first step: how to connect to them? I guess I need something like CREATEOBJECT("word.application"), "tuned" for these libraries... or not?



-- Jumpjack --
 
From the code window select "Tools / References" and check the ones that you want. for example, if you select

Microsoft Excel 10.0 Object Library​

Then you can do things like
Code:
Dim oExcelApp As New Excel.Application
oExcelApp.Workbooks.Add
etc.
 
You just told me to do exactly what I told you I did! :)

But what I miss is what to use in place of "Excel.application": is there any way to discover the "handle" of the libraries?

-- Jumpjack --
 
Perhaps:
Code:
Public Sub GetRefList()
   Dim ref As Reference
   
   For Each ref In Application.References
      Debug.Print ref.Name
      'Debug.Print "Version " & ref.Major & "." & ref.Minor
      'If ref.Guid <> "" Then Debug.Print "Guid = "; ref.Guid
      'Debug.Print ref.FullPath
   Next
   
End Sub

Names pop-up with intellisense, too.
 
Ah, no, it's Access 95...
It doesn't even support "Dim ref As Reference" and "Application.References"... :-(

-- Jumpjack --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top