View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default how to send a workbook shortcut as attachement in an e-mail from a userform

Why not fill in the real path to the file ??

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Valeria" wrote in message ...
Hi Ron,
I have tried this but I still have problems: VBA claims it
can't find the file I want to attach. Actually the file I
want to attach is a shortcut to a file (I have created the
shortcut in the folder), might this be the problem?
Otherwise I am sure the path to the file is OK.

Many thanks in advance!
Best regards,
Valeria


Private Sub Label3_Click()

Application.OnKey "^{F11}", "Show_Userform"
'You must add a reference to the Microsoft outlook Library

Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "bla bla bla"
.Body = "bla bla bla"
.Attachments.Add ("\\server\Shortcut to my
file.xls")
.Display
End With
Set OutMail = Nothing
Set OutApp = Nothing

Me.Hide
End Sub

-----Original Message-----
Hi Valeria

Try one of the examples on my SendMail page.
Post back if you need more help
http://www.rondebruin.nl/sendmail.htm


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Valeria" wrote in

message ...
Dear experts,
I am working on a userform and I would like to put in
there a label - when the user clicks on it, an e-mail
message opens that has as an attachment the shortcut to

a
certain workbook on a server.
The "to" field should be populated but the user should
have the possibility to change the names if he/she wants
to. Also the subject line should populated. There should
also be a little message in the body of the e-mail.

I do not know how to achieve this - could you please

help
me?
Many thanks in advance!
Best regards,
Valeria



.