Windows API Call From Outlook Form

  • Thread starter Thread starter Al Berg
  • Start date Start date
A

Al Berg

I'm can't seem to figure out how to make a windows api cal from VBA inside
of outlook. For example if I put the following code into the onclick event
handler for a command button, I always get the error "Expected end of
statement Line No:1".

I'm using the forms script editor to enter this code;

Private Declare Function MessageBeep Lib "user32" Alias "MessageBeep" (ByVal
wType As Long) As Long

Sub CommandButton1_Click()

MsgBox "The active window is an explorer", vbInformation

End Sub

<<<

What am I don't wrong?

Thanks AB
 
You can't. Outlook forms use VBScript, which doesn't support function
declarations.

Maybe if you explained what you want to do behind the form, someone could
suggest another approach.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Hi Sue,

is it possible to call a public class modul in the VBA project from
within the form?
 
YOu can call a Public sub or function that resides in the ThisOutlookSession
module by using Application.myproc, but but it's an unsupported technique.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Michael Bauer said:
Hi Sue,

is it possible to call a public class modul in the VBA project from
within the form?
 
Ok, thank you.


--
Viele Grüße
Michael Bauer


Sue Mosher said:
YOu can call a Public sub or function that resides in the ThisOutlookSession
module by using Application.myproc, but but it's an unsupported technique.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Ahh... that explains a lot. I thought I was using VBA, not that I know it's
VBScript at least I can be looking at the right docs.

I need to be able to be able to create, send and process the response to a
SOAP message from the form but I think I can see how to do that now.

Of course if you have any suggestions, I'm all ears.

Thanks for the help,
AB
 
Back
Top