Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

email Word.docm as PDF

Posted on 2013-12-09
2
Medium Priority
?
692 Views
Last Modified: 2013-12-09
Hi,
I have code (attached) that works as far as sending the document as a macro enabled document.
I have tried messing around with the "activedocument.fullname" part to change it to have a PDF suffix, but with my limited knowledge of VBA i'm getting nowhere.

What I would like the code to do is send the current word document as a PDF file to email recipients instead of a macro enabled document, as people need to open it on their smart phones so PDF is the best option.

As always any help is greatly appreciated.

Dim olkApp As Object
Dim strSubject As String
Dim strTo As String
Dim strBody As String
Dim strAtt As String
ActiveDocument.Save
    strSubject = "Plant 2 Downtime document"
    strBody = "Please see attached File"
'   strTo = "someone@somefirm.com"
    strTo = "me@somewhereelse.com"
    If ActiveDocument.FullName = "" Then
        MsgBox "activedocument not saved, exiting"
        Exit Sub
    Else
        If ActiveDocument.Saved = False Then
            If MsgBox("Activedocument NOT saved, Proceed?", vbYesNo, "Error") <> vbYes Then Exit Sub
        End If
    End If

  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

Open in new window

0
Comment
Question by:Stephen Byrom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 39707250
You can save a document as PDF, so:
   
ActiveDocument.SaveAs "C:\MyFolder\MyDoc.pdf", wdFormatPDF

Open in new window

0
 
LVL 1

Author Closing Comment

by:Stephen Byrom
ID: 39707920
Thanks, it was the "wdFormatPDF" that eluded me.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
This video walks the viewer through the process of creating a watermark for their document, customizing it, and saving it for viewing/printing needs.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question