Z
zssachen
Hello,
Any suggestions on why I get a "Run Time Error '-1407020020
(a838838833)': Can't find this file. Make sure the path and file name
are correct." in the code below?
Public Sub Application_Startup()
' Reference the items in the Inbox. Because myOlItems is declared
' "WithEvents" the ItemAdd event will fire below.
Set myOlItems =
Outlook.Session.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub myOlItems_ItemAdd(ByVal Item As Object)
' Check to make sure it is an Outlook mail message, otherwise
' subsequent code will probably fail depending on what type
' of item it is.
If TypeName(Item) = "MailItem" Then
Dim mailToFwd As MailItem
Set mailToFwd = Item
'create a new message and address it
Dim myEmail As MailItem
Set myEmail = Application.CreateItem(olMailItem)
myEmail.To = "(e-mail address removed)"
myEmail.Subject = "FYI"
' attaching the file
myEmail.Attachments.Add (Item)
' now send the message
myEmail.Send
End If
End Sub
Any suggestions on why I get a "Run Time Error '-1407020020
(a838838833)': Can't find this file. Make sure the path and file name
are correct." in the code below?
Public Sub Application_Startup()
' Reference the items in the Inbox. Because myOlItems is declared
' "WithEvents" the ItemAdd event will fire below.
Set myOlItems =
Outlook.Session.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub myOlItems_ItemAdd(ByVal Item As Object)
' Check to make sure it is an Outlook mail message, otherwise
' subsequent code will probably fail depending on what type
' of item it is.
If TypeName(Item) = "MailItem" Then
Dim mailToFwd As MailItem
Set mailToFwd = Item
'create a new message and address it
Dim myEmail As MailItem
Set myEmail = Application.CreateItem(olMailItem)
myEmail.To = "(e-mail address removed)"
myEmail.Subject = "FYI"
' attaching the file
myEmail.Attachments.Add (Item)
' now send the message
myEmail.Send
End If
End Sub