PDA

View Full Version : Simple PhoneBook



ndendrinos
08-27-2006, 01:54 PM
Keeping the workbook simple is there a way to:

Click on the email address and have Outlook express open with the address already in place?
(same as in Access with a form while typing in the the table "mailto:etc...)

Click on the phone number and have Windows dial the number

Click on the fax number and fax through Windows Fax (XP)


Of these three wishes the first one is the most important.
Thank you

lucas
08-27-2006, 07:50 PM
I think you can work the first one with a sheet change event:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim objOLapp As Object
Dim objMailItem As Object

Set objOLapp = CreateObject("Outlook.Application")
Set objMailItem = objOLapp.CreateItem(0) '0=mailitem

With objMailItem
.To = ActiveCell.Value
.Display 'show the mail
'.Send 'send the mail = OMG!
End With
'I added the following to get rid of the hyperlinks....better ideas?
Range("A:A").Select
Selection.Hyperlinks.Delete
Range("B1").Select
End Sub

I think the phone dialer is a bigger problem....maybe someone has an idea but be careful.

Charlize
08-28-2006, 03:09 PM
I found this on xcelfiles.com . Maybe you can give this a try.



Option Explicit
Public Declare Function tapiRequestMakeCall Lib "TAPI32.DLL" ( _
ByVal Dest As String, _
ByVal AppName As String, _
ByVal CalledParty As String, _
ByVal Comment As String) As Long
Sub PhoneCall()
Dim strNumber As String
Dim strName As String
Dim lRetVal As Long
strNumber = "09 2751179"
strName = "Work"
'// Make a voice call using the default call manager application
lRetVal = tapiRequestMakeCall(Trim(strNumber), vbNull, Trim(strName), "")
'// Let the call manager application handle the errors!
End Sub


You've got to post this in a module.
alt+f11 (vbe) - if no module present insert one.
paste code
close vbe
alt+f8
choose Phonecall

maybe you can change the number that's dialing...

Charlize

ndendrinos
08-28-2006, 04:03 PM
Thank you both and sorry for the delay ... first day back to work after 2 weeks holidays.

Lucas: ran your code & got "Run Time Error 429
Active X component can't create Object
Line yellowed = Set obj Lapp = Create Object .....

Charlize: ran your code also and it works problem is it embeds the phone
number that's part of the code not practical for this situation but I
will use it on another application.

Again thanks
Nick

lucas
08-28-2006, 04:27 PM
You must have outlook for the code I posted to work. You may also need a reference checked to Outlook

ndendrinos
08-28-2006, 05:00 PM
No wonder I couldn't get the ref to outlook to load this morning ... I use Outlook Express will install Outlook and I'm sure it will work.
Thanks Lucas

Guess the rest of the "wish list" is kind of impossible .
I will mark this "solved" tomorrow just in case

Charlize
08-28-2006, 11:39 PM
Thank you both and sorry for the delay ... first day back to work after 2 weeks holidays.

Lucas: ran your code & got "Run Time Error 429
Active X component can't create Object
Line yellowed = Set obj Lapp = Create Object .....

Charlize: ran your code also and it works problem is it embeds the phone
number that's part of the code not practical for this situation but I
will use it on another application.

Again thanks
Nick

When you move to the cell with the number in it you can use a button to make a call. With activecell.value you can store this in the variable. The variable is a string.


dim phoneno as string
phoneno = activecell.value


Charlize

ndendrinos
08-29-2006, 03:35 AM
Charlize thank you for your suggestion it works great !

Two down and one to go ... Maybe it is too soon to mark this one "solved" yet.

Will also visit "xcelfiles.com"