Link to home
Start Free TrialLog in
Avatar of peispud
peispudFlag for Canada

asked on

Send/Print an Excel 2013 range to a PDF, jpg, or other picture. The range object is a calendar (1 month)

I've been looking for a solution on this.   There are lots of solutions,  but there seem to be lots of caveats.

I need to send/print  a picture of the excel 2013 range to a file for easy viewing (no editing)  by other people.   It is only one page long.  I would prefer to send it as a PDF file, but I can't imagine why a jpg, png or other pic file wouldn't do the same thing.   I am using Gmail as my email provider.

Then that file would be added as an attachment to an email (manually for now).
Avatar of Glenn Ray
Glenn Ray
Flag of United States of America image

You can paste an image of any copied range of an Excel worksheet.

1) Select the range and then copy ([Ctrl]+[C])
2) Open a new email (assuming MS Outlook here)
3) Select the drop arrow below the "Paste" icon in the Clipboard section of the Message ribbon in your email form.
4) Select PasteSpecial.  You'll see a new dialog box.
5) Select "Picture (Enahnced Metafile)" and click the OK button.
User generated image
This will display a scaled image of your selected range, including any charts.

Regards,
-Glenn
Avatar of peispud

ASKER

I appreciate your reply, but I am using Gmail.

Furthermore,  I am looking for a more automated solution.  This range represents one month of work scheduling. Although I could do this easily, others might find the procedure to be a bit too much.
ASKER CERTIFIED SOLUTION
Avatar of Professor J
Professor J

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of peispud

ASKER

Another great answer and I will accept if gratefully, but I do have a question though about this code.

I had to comment out the following code in order for the file to be created in the same directory  as the Excel workbook.
I might add that I am using Windows 8.1.
My question.  What is the normal purpose for the code below?

 For Each char In Split("? "" / \ < > * | :")
    PdfFile = Replace(PdfFile, char, "_")
  Next

Open in new window

Avatar of Professor J
Professor J

the line above was a code to replace any wrong character in case if used.   if you do not like it and it is confusing for you, then use the version below.


it will save it to the same folder and also do not include that addtional lines.

Sub SheetToPDF()
  Dim IsCreated As Boolean
  Dim i As Long
  Dim PdfFile As String, Title As String
  Dim OutlApp As Object
 
  PdfFile = ActiveWorkbook.FullName
  i = InStrRev(PdfFile, ".")
  If i > 1 Then PdfFile = Left(PdfFile, i - 1)
  PdfFile = PdfFile & "_" & ActiveSheet.Name & ".pdf"
 
  With ActiveSheet
    .ExportAsFixedFormat Type:=xlTypePDF, Filename:=PdfFile, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
  End With
  
  MsgBox "EXPORTED IN THE SAME FOLDER"
End Sub

Open in new window

This might be a bit organic, but I downloaded a Google Chrome Extension called Lightshot. I use it everyday to screen shot Excel data and email it to interested parties.  I simply paste the screen shot into my email, but you could also paste it into a Word doc and PDF that if you needed to.
Avatar of peispud

ASKER

Thank you all!