B
Bunky
I am trying to send a message within an Access Module within an Access Macro
after doing some other work. Everything works
well when I am in debug but when I try to run in a macro I get an error. I
have saved the code below in a module named 'Send File to Joy' and then do a
'RunCode' with 'Send File to Joy()' in the Function Name. The error I am
getting is 'Micorsoft Office Access can't find the name 'Send' you entered in
the expression.'
What am I doing wrong?
Module code below:
Private Sub Joy_Click()
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, "Query for Joy
", "\\bxgfs1\shared\Member Comm\AddrChange\Arvact-list" & Format(Date,
"mm-dd-yy") & ".xls", True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, "Query for Joy
", "\\iocc-server\dcs\address Changes\Backups for the weekly address
file\Joy's Excel File\2008\Arvact-list" & Format(Date, "mm-dd-yy") & ".xls",
True
MsgBox "File has been transfered to Boca's Shared Drive & backup Server. ",
vbOKOnly, ""
On Error GoTo Err_Joy_Click
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = "(e-mail address removed)"
.Subject = "Joy-the Arvact list is ready."
.body = ""
.Send
End With
Exit_Joy_Click:
Exit Sub
Err_Joy_Click:
MsgBox Err.Description
Resume Exit_Joy_Click
End Sub
after doing some other work. Everything works
well when I am in debug but when I try to run in a macro I get an error. I
have saved the code below in a module named 'Send File to Joy' and then do a
'RunCode' with 'Send File to Joy()' in the Function Name. The error I am
getting is 'Micorsoft Office Access can't find the name 'Send' you entered in
the expression.'
What am I doing wrong?
Module code below:
Private Sub Joy_Click()
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, "Query for Joy
", "\\bxgfs1\shared\Member Comm\AddrChange\Arvact-list" & Format(Date,
"mm-dd-yy") & ".xls", True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, "Query for Joy
", "\\iocc-server\dcs\address Changes\Backups for the weekly address
file\Joy's Excel File\2008\Arvact-list" & Format(Date, "mm-dd-yy") & ".xls",
True
MsgBox "File has been transfered to Boca's Shared Drive & backup Server. ",
vbOKOnly, ""
On Error GoTo Err_Joy_Click
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = "(e-mail address removed)"
.Subject = "Joy-the Arvact list is ready."
.body = ""
.Send
End With
Exit_Joy_Click:
Exit Sub
Err_Joy_Click:
MsgBox Err.Description
Resume Exit_Joy_Click
End Sub