Thanks for your response. Pls find the code. It was earlier working, for some
reason, it takes my attachment as .lnk and does not sent the attachment due
to restrictions in sending .lnks in setup.
Any help is greatly appreciated. Thanks again.
Private Sub CommandButton1_Click()
Dim bStarted As Boolean
Dim oOutlookApp As Object
Dim oItem As Object
On Error Resume Next
'Get Outlook if it's running
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
'Outlook wasn't running, start it from code
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If
'Create a new mailitem
Set oItem = oOutlookApp.CreateItem(olMailItem)
With oItem
.To = "johnk@techaffinity.com"
.CC = "johnk@techaffinity.com"
.Subject = ActiveDocument.FullName
.Attachments.Add ActiveDocument.FullName, olByValue, 1, "Document as
attachment"
.Display
End With
If bStarted Then
'If we started Outlook from code, then close it
oOutlookApp.Quit
End If
'Clean up
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub
jack was telling us:
jack nous racontait que :
> Thanks for your response. Pls find the code. It was earlier working,
You mean earlier as in "This morning" or as in "an earlier version of
Office"???
> for some reason, it takes my attachment as .lnk and does not sent the
> attachment due to restrictions in sending .lnks in setup.
What setup are you referring to?
Outlook is not more secure and prevents other program from manipulating the
sending of emails or the access to its address book.
For more on this, see:
http://www.slipstick.com/outlook/esecup/admin.htm
and
http://www.dimastr.com/redemption/
for a nice workaround to these restrictions
<snip>
> With oItem
> .To = "johnk@techaffinity.com"
> .CC = "johnk@techaffinity.com"
> .Subject = ActiveDocument.FullName
Make sure the document as been saved or it will not work.
> .Attachments.Add ActiveDocument.FullName, olByValue, 1, "Document as
> attachment"
> .Display
> End With

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org