Solved

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

Posted on 2014-10-27
7
160 Views
Last Modified: 2014-10-29
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).
0
Comment
Question by:peispud
[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
7 Comments
 
LVL 27

Expert Comment

by:Glenn Ray
ID: 40407514
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.
paste special
This will display a scaled image of your selected range, including any charts.

Regards,
-Glenn
0
 

Author Comment

by:peispud
ID: 40407525
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.
0
 
LVL 26

Accepted Solution

by:
ProfessorJimJam earned 500 total points
ID: 40407542
HERE YOU GO   converts to pdf and then saves it in default folder of your application.


Sub SheetToPDF()
  Dim PdfFile As String, char As Variant, i As Long
  

  If Val(Application.Version) < 12 Then
    MsgBox "Export to PDF requires Excel 2007+", vbExclamation, "SheetToPDF"
    Exit Sub
  End If
  

  PdfFile = ActiveWorkbook.Name
  i = InStrRev(PdfFile, ".xl", , vbTextCompare)
  If i > 1 Then PdfFile = Left(PdfFile, i - 1)
  PdfFile = ActiveWorkbook.Path & "\" & PdfFile & "_" & ActiveSheet.Name
  For Each char In Split("? "" / \ < > * | :")
    PdfFile = Replace(PdfFile, char, "_")
  Next
  PdfFile = Left(PdfFile, 251) & ".pdf"
 
  With ActiveSheet
    .ExportAsFixedFormat Type:=xlTypePDF, Filename:=PdfFile, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
  End With
 

  MsgBox "PDF file:" & vbLf & PdfFile, vbInformation, "SheetToPdf"
 
End Sub

Open in new window

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:peispud
ID: 40407568
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

0
 
LVL 26

Expert Comment

by:ProfessorJimJam
ID: 40407874
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

0
 
LVL 7

Expert Comment

by:Katie Pierce
ID: 40409660
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.
0
 

Author Closing Comment

by:peispud
ID: 40410604
Thank you all!
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 code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

730 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