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

Please help - variable not defined

Status
Not open for further replies.

shaunacol

Programmer
Jan 29, 2001
226
GB
I am trying to use the code provided in FAQ705-537

However, I am getting error-variable not defined when I press the command button.

The highlighted area is at the bottom of the on-Click command (SW_SHOWNORMAL).

I'm afriad I don't understand the code fully enough to check where I have gone wrong...I am not sure if I have declared SW_SHOWNORMAL or not...

Ta s
 
well, the code works fine here.

I will tell you what I did. Maybe you find what you did wrong.
I started a new database.

I created a new module, and pasted this code in it:
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

I saved this module.

Then I created a new form, with 6 textboxes and a button on it. I named the 6 textboxes: txtmainaddresses, txtCC, txtBCC, txtSubject, txtbody, txtAttachment.

I named the button: Command0.

I opened the properties of the button, and on the event tab, I created an event for 'On Click'.
In this event I pasted the rest of the code.

And it worked!


 
In the declarations section, below the declaration for ShellExecute:
Public Const SW_SHOWNORMAL = ???

I can't remember the value for ??? off the top of my head :-(

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top