G
Guest
I am trying to write code that will automatically enter the contents of a
control (called Identifier) on my form when a user clicks a button on the
form. Currently, the button is "powered" by a macro using the SendObject
command. I've found information by Tony Towes and Arvin Meyer, but so far I
can't get the code to work. (Error message is described below.)
I took the Click event of the button that ran the "SendMail" macro and
substituted the following:
Private Sub cmdSend_Click()
On Error GoTo Err_cmdSend_Click
Dim objOutlook As Outlook.Application
Dim ojbEmail As Outlook.MailItem
Set objOutlook = CreateObject("Outlook.application")
SetobjEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.Subject = Me!Identifier
End With
Exit_cmdSend_Click:
Exit Sub
Err_cmdSend_Click:
MsgBox Err.Description
Resume Exit_cmdSend_Click
End Sub
Here's the error: "User-defined type not defined" and what is highlighted
is " Dim objOutlook As Outlook.Application". Can anyone point out what I'm
doing wrong -- or point to another way of auto-entering info into a Subject
line? Thanks!
control (called Identifier) on my form when a user clicks a button on the
form. Currently, the button is "powered" by a macro using the SendObject
command. I've found information by Tony Towes and Arvin Meyer, but so far I
can't get the code to work. (Error message is described below.)
I took the Click event of the button that ran the "SendMail" macro and
substituted the following:
Private Sub cmdSend_Click()
On Error GoTo Err_cmdSend_Click
Dim objOutlook As Outlook.Application
Dim ojbEmail As Outlook.MailItem
Set objOutlook = CreateObject("Outlook.application")
SetobjEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.Subject = Me!Identifier
End With
Exit_cmdSend_Click:
Exit Sub
Err_cmdSend_Click:
MsgBox Err.Description
Resume Exit_cmdSend_Click
End Sub
Here's the error: "User-defined type not defined" and what is highlighted
is " Dim objOutlook As Outlook.Application". Can anyone point out what I'm
doing wrong -- or point to another way of auto-entering info into a Subject
line? Thanks!