Solved

email Word.docm as PDF

Posted on 2013-12-09
2
635 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
2 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Introduction Authors who set out to write any sort of lengthy piece for online submission—be it a long question or comment on a technical form, an article, or a substantial blog entry—often find it useful to work up a draft in an editor other t…
If you work with Word a lot, you probably use styles. If you use styles a lot, you've probably balled your fist more often than not when working with the ribbon. In Word 2007/2010, one of the things that I find missing when using styles is a quic…
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

770 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