I posted on this forum quite some time ago about a problem with this macro (below). Thanks to everyone who responded - moving "doc.close" right to the end of the code fixed the problem
I now have a new problem which is being almost as annoying as the last - the "importance" of emails being sent with the macro is always coming up as low importance. I need the emails to automatically be normal importance. This used to work fine - I have no idea why it doesn't any more. We've been living with it for a while, but a new staff member seems unable to untick the low importance option, so we now really need to resolve this.
NOTE: The aim of the macro is to allow the user to email a link for a word document (saved on our shared network folder) to another person in the office (we had a lot of trouble with people attaching files to emails and not saving them properly). When a button is pressed, the macro saves and closes the document, and then opens up a new email message in outlook with the link ready to send.
Some more info that might be helpful:
- The macro is now in a global template on our shared network drive, however this problem also occurred when it was stored locally on each computer.
- I have tried changing .Importance from "1" to "olImportanceNormal". It makes no difference.
- I have tried changing .Importance to "2" and "olImportanceHigh". When I did this, the first time I tried to use the macro, the email came up as high importance, but then all further emails came up as low importance.
- The problem doesn't seem to be specific to a particular user, computer, template or version of word.
Does anyone have any ideas why this isn't working and how I might fix it?
Please note I'm not great at writing macros, so please make any replies as easy to understand as possible!!!
Thanks in advance for your help
Sub eMailActiveDocument()
Dim OL As Object
Dim EmailItem As Object
Dim Doc As Document
Dim DisplayMessage As Boolean
Dim Test1 As String
Dim Response1 As VbMsgBoxResult
Dim Response2 As VbMsgBoxResult
Dim Saved As Boolean
Test1 = ActiveDocument.FullName
Application.ScreenUpdating = False
Set OL = CreateObject("Outlook.Application")
Set EmailItem = OL.CreateItem(olMailItem)
Set Doc = ActiveDocument
Response2 = MsgBox("The Document must be saved and closed before it can be opened by another user. Would you like to do this now?", vbYesNoCancel, "Save & Close?")
If Response2 = vbCancel Then Exit Sub
If Response2 = vbYes Then
Doc.Save
Test1 = ActiveDocument.FullName
End If
With EmailItem
.Importance = 1
.HTMLBody = "<HTML><BODY><A href=""" & Test1 & """>""" & Test1 & """</A> </BODY></HTML>"
End With
Application.ScreenUpdating = True
EmailItem.Display
Doc.Close
End Sub



Reply With Quote
