attachment not working

G

Guest

Hi,

I have created a custom Post based form and published it
to a public folder. I have written code that creates an
email and adds the current form as a refernence
attchement. The form is then saved to the public folder.
However, when the email is recieved and the user clicks on
the attachment, nothing happens. Can anyone help me with
this?
Here is the code :
set
Set myItem = Application.CreateItem(0)
myitem.Attachments.Add
Application.ActiveInspector.CurrentItem

myItem.Subject = "ECS needs to be updated"
myItem.Send
Thanks

Amit
 
S

Sue Mosher [MVP]

I think By Value is the default for attachments, not By Reference. In any case, I have never been able to get a link to an Outlook item to work with Attachments. Have you considered using a text link? The two main drawbacks with those are that they might not work if the user hasn't already used Public Folders during the current Outlook session and they look funny. Some sample code for a form command button:

Sub CommandButton1_Click()
Item.Save
Set myItem = Application.CreateItem(0)
' use this if you want to attach a copy of the item in the folder
myitem.Attachments.Add Item, 1,, "By Value"
' use this if you want to include a text link
MyItem.Body = myItem.Body & vbCrLf & vbCrLf & "Outlook:" & Item.EntryID & vbCrLf
myItem.Subject = "ECS needs to be updated"
myItem.To = "(e-mail address removed)"
myItem.Send
Item.CLose 1
End SUb

--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top