M
matt
Hi all,
I have some code that send the document as an attachment throught Outlook.
The file contains many linked objects to excel files and such. The problem is
when i send the document(I have security set-up with a password and all) and
the receiver recieves the attachment they still have the option to update the
links. Is the a way to send it as like an image of the document which would
remove all the links and just have say "placeholders" for them without being
linked?
'SEND REPORT AS ATTACHMENT
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
On Error Resume Next
If Len(ActiveDocument.Path) = 0 Then
MsgBox "Document needs to be saved first"
Exit Sub
End If
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If
Set oItem = oOutlookApp.CreateItem(olmailitem)
Dim iDay As Integer
Dim iMonth As Integer
Dim dtYesterday As Date
dtYesterday = DateAdd("d", -1, Now)
iDay = DatePart("d", dtYesterday)
iMonth = DatePart("m", dtYesterday)
'Here you can edit the To:, CC:, and Subject: of the mail item
With oItem
.To = InputBox("Fill-In who you would like to send this Report to.",
"To:", "(e-mail address removed)")
.CC = InputBox("Would you like to CC: this email to someone?" &
vbCrLf & _
vbCrLf & "If yes fill-in who you would like to CC: the email
to and click OK:" & vbCrLf & "Else just click Cancel.", "CC:")
.Subject = InputBox("Fill-in the subject for this email:",
"Subject:", ".COM Daily Operational Report " & _
CStr(iDay) & "-" & MonthName(iMonth) & "-" & Year(Date))
'Add the document as an attachment
'you can use the .displayname property to set the description that's
used in the message
.Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue,
DisplayName:="Document as attachment"
.Display
'.Send
End With
If bStarted Then
oOutlookApp.Quit
End If
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub
_____________________
SOME LINES ARE CUT SHORT...
I have some code that send the document as an attachment throught Outlook.
The file contains many linked objects to excel files and such. The problem is
when i send the document(I have security set-up with a password and all) and
the receiver recieves the attachment they still have the option to update the
links. Is the a way to send it as like an image of the document which would
remove all the links and just have say "placeholders" for them without being
linked?
'SEND REPORT AS ATTACHMENT
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
On Error Resume Next
If Len(ActiveDocument.Path) = 0 Then
MsgBox "Document needs to be saved first"
Exit Sub
End If
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If
Set oItem = oOutlookApp.CreateItem(olmailitem)
Dim iDay As Integer
Dim iMonth As Integer
Dim dtYesterday As Date
dtYesterday = DateAdd("d", -1, Now)
iDay = DatePart("d", dtYesterday)
iMonth = DatePart("m", dtYesterday)
'Here you can edit the To:, CC:, and Subject: of the mail item
With oItem
.To = InputBox("Fill-In who you would like to send this Report to.",
"To:", "(e-mail address removed)")
.CC = InputBox("Would you like to CC: this email to someone?" &
vbCrLf & _
vbCrLf & "If yes fill-in who you would like to CC: the email
to and click OK:" & vbCrLf & "Else just click Cancel.", "CC:")
.Subject = InputBox("Fill-in the subject for this email:",
"Subject:", ".COM Daily Operational Report " & _
CStr(iDay) & "-" & MonthName(iMonth) & "-" & Year(Date))
'Add the document as an attachment
'you can use the .displayname property to set the description that's
used in the message
.Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue,
DisplayName:="Document as attachment"
.Display
'.Send
End With
If bStarted Then
oOutlookApp.Quit
End If
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub
_____________________
SOME LINES ARE CUT SHORT...