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
148 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
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 25

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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 25

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now