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

Input Dialog Userform

Status
Not open for further replies.

gloudo

Programmer
Feb 3, 2002
34
NL
I Have a Excel Workbook with a Userform.
On The Form is a textbox where the user fills in
an Email adress. When Pressing Ok-Button
the email adress is transverted to the outlook recipient
field.
My Question is the part of code to get the adress from the textbox to the code for filling the mailform.

Code So Far:

Dim sFileName As String
Dim sRecip As String

Private Sub anulerenbtn_Click()

Unload Form1

End Sub

Private Sub okbtn_Click()
On Error GoTo Err_okbtn_Click

Dim objOL As New Outlook.Application
Dim objMail As MailItem
Set objOL = New Outlook.Application
Set objMail = objOL.CreateItem(olMailItem)


sFileName = Application.GetSaveAsFilename( _
fileFilter:="Excel Files (*.xls), *.xls")

Select Case sFileName

Case sFileName = "False"
Exit Sub

Case sFileName = "True"
GoSub Mail
End Select

Mail:

With objMail
.To = sRecip
.CC = "Hans Zwennes"
.Subject = "Probleemhoek Formulier" & " " & Date
.Body = "Dit Is een Test"
.Display
.Attachments.Add sFileName
End With

Exit_okbtn_Click:
Set objMail = Nothing
Set objOL = Nothing
Exit Sub

Err_okbtn_Click:
MsgBox Err.Description
Resume Exit_okbtn_Click

End Sub



Thanks,
 
Hi,
If I am understanding you...
Code:
sRecip = UserForm1.TextBox1.Text
Hope this helps :) Skip,
metzgsk@voughtaircraft.com
 
Hi There,

It Worked great, Thanks for the tip.
It had to be altered a bit, but then it worked
Thijs,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top