I've set up a form that fills out the active document. Obviously this document is macro enabled because i'm using VBA. Once form is completed and submitted it will attach the active document to an outlook email. My IT team doesn't allow macro enabled documents to be sent over our systems so the email wont be allowed to send with a .docm attachment
I've tried to convert the document myself, but i'm not very savvy with VBA in this regard.
This is the code I have so far.
Private Sub OpenEmailAndAttach()
Dim olkApp As Object
Dim strSubject As String
Dim strTo As String
Dim strBody As String
Dim strAtt As String
strSubject = "Expenditure Approval Request"
strBody = "Hi, " & Chr(10) & Chr(10) & "Please could I request approval RE: works" & Chr(10) & Chr(10) & "EAF is attached" & Chr(10) & Chr(10) & "Regards, " & Chr(10) & "Name"
strTo = "[email protected]"
strAtt = ActiveDocument.FullName
Set olkApp = CreateObject("outlook.application")
With olkApp.createitem(0)
.to = strTo
.Subject = strSubject
.body = strBody
.attachments.Add strAtt
'.send
.Display
End With
Set olkApp = Nothing
End Sub
It works, but I need it to be attached as a .docx (non macro enabled) not a .docm file. Is it possible to do this type of conversion while attaching a document?
ActiveDocument.FullName
) - there's no way Outlook can make the conversion. In order to save the file as a docx, the macro code do perform these actions needs to be stored somewhere else. Best would probably be to save this docm as a dotm (a template) then create a new document from it each time you want to use it. The macro will be in the template and the document created from the template will be a docx by default. So then this code would work as you wish. – Cindy Meister