Solved

email Word.docm as PDF

Posted on 2013-12-09
2
680 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 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
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…
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
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.

630 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