Using TAPI in Excel VBA

A

Andrew

I wish to dial telephone numbers from an Excel VBA macro using my PC's
modem. A Google search came up with:
http://www.ozgrid.com/forum/showthread.php?t=16781
and
http://www.mrexcel.com/forum/showthread.php?t=70207
amongst others. Essentially they declare a function to access tapi32.dll:

Declare Function tapiRequestMakeCall Lib "TAPI32.DLL" (ByVal lpszDestAddress
As String, ByVal lpszAppName As String, ByVal lpszCalledParty As String,
ByVal lpszComment As String) As Long

And then use the function:

x = tapiRequestMakeCall(cPhone, "", cName, "")

where cPhone is a string containing the required number. e.g. "0123456789"

This works as expected. The Phone Dialer application pops up two windows at
the top left of the screen, once labelled "Preview" and the other "Phone
Call". However, I actually want to dial 'numbers' including the * and #
characters, for example, to cancel ringback on the BT network by dialling
"#37#" etc. If I enter a non-numeric number the second window has the title
"Internet Call" and the call fails with the message "Failed: wrong number or
the called device is out of service".

I can dial such numbers manually using Phone Dialer where I am able to
select whether I wish to dial as a Phone Call or as an Internet Call.

How can I dial # and * on the modem using TAPI32?
 
A

Andreas Marschall [MVP TAPI]

Andrew said:
x = tapiRequestMakeCall(cPhone, "", cName, "")

where cPhone is a string containing the required number. e.g. "0123456789"

This works as expected. The Phone Dialer application pops up two windows at
the top left of the screen, once labelled "Preview" and the other "Phone
Call". However, I actually want to dial 'numbers' including the * and #
characters, for example, to cancel ringback on the BT network by dialling
"#37#" etc. If I enter a non-numeric number the second window has the title
"Internet Call" and the call fails with the message "Failed: wrong number or
the called device is out of service".

I can dial such numbers manually using Phone Dialer where I am able to
select whether I wish to dial as a Phone Call or as an Internet Call.

How can I dial # and * on the modem using TAPI32?

Andrew,
the issue isn't caused by TAPI32.DLL but by MS Dialer.exe (Version from Active
Voice Corporation for W2k and XP).
This Phone Dialer interprets (by design) a non-numeric char within the
DestAddress as an internet-call request.

You can try to either use another TAPI app as MakeCall request recipient,
or develop a complete TAPI app yourself,
or use a some 3rd party component / control for this.

--
Best Regards
Andreas Marschall
Microsoft MVP for TAPI / Windows SDK / Visual C++
TAPI / TSP Developer and Tester
My TAPI and TSPI FAQ:
http://www.I-B-A-M.de/Andreas_Marschall's_TAPI_and_TSPI_FAQ.htm
My Toto® Tools (a collection of free, mostly TAPI related tools):
http://www.i-b-a-m.de/Andreas_Marschall's_Toto_Tools.htm
TAPI development around the world (Frappr! map):
http://www.frappr.com/TAPIaroundTheWorld
* Please post all messages and replies to the newsgroup so all may
* benefit from the discussion. Private mail is usually not replied to.
* This posting is provided "AS IS" with no warranties, and confers no rights.
 
M

Matthias Moetje [MVP]

Andrew,

when you feed a phone number to the phone dialer
through tapiRequestMakeCall it must be in canonical
or plain number format.

If you want to have prefixes dialed you should configure
these in the location settings (Phone and Modem Options).

Best regards,

Matthias Moetje
 

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