Using a COM server DLL in Word VBA?

L

Lüko Willms

I can't get it...

It should be possible --- Tobit's server "David" for unified
messaging supplies a DLL called DvAPI32.DLL which is a COM server
providing objects and methods and properties to be used in C/C++ or
Visual Basic, and maybe other languages. This DLL comes with a *.TLB
(I guess a Type Library for the DLL with the same base name) and is
accompanied by a DvCTL32.DLL.

I try to use it in a VBA macro in Winword (2000 or 97 are avaiable
to me), but the compilation fails right in the first line because of
an unknown or undefined user type.

The vendor gives examples for VB, with the commend "The Visual Basic
example assumes that you have set references to the DvISE API". Well,
I don't know how to do it. Probably I need a Class module with some
initialisation code. But then I don't now how to do that.

Can please anybody help me?

This is how the VB examples normally do begin:

------- cut ------------
Dim oApp As DvApi32.IApplication
Dim oAcc As DvApi32.Account
Dim oUser As DvApi32.User
Dim oAddressItem As DvApi32.AddressItem

Set oApp = CreateObject("DVOBJAPILib.DvISEAPI")
Set oAcc = oApp.Logon("", "", "", "", "", "AUTH")
-------------- cut off --------

VBA flags the first line as undefined user type ...

The DLL, by the way, is registered by a RegSrv32 DvAPI32.DLL


Cheers,
L.W.
 
J

Jay Freedman

In the VBA editor, click Tools > References. Either try to find the COM
server in the list (although the display string could be almost anything) or
click the Browse button and locate the DvAPI32.DLL file. Once the item is
checked in the list, click OK. Now you should be able to run the macro.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
L

Lüko Willms

Am Mon, 20 Aug 2007 19:06:29 UTC, schrieb "Jay Freedman"
In the VBA editor, click Tools > References.

That was it! Many thanks!

I remember having done that for e.g. the MS date picker...
Either try to find the COM server in the

't was easy to find
Now you should be able to run the macro.

At least the "undefined user type" is gone, now I get into other
errors of using the interface, but after the main stumbling block I
found the entry into that garden.


Thanks again!
L.W.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top