• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Exporting each and every sheet in excel worbook to indiviudal images

amni

New Member
Hello excel experts,I am new to this vba coding ....
I am looking for code that which can able to export all the sheets in excel to images individually files.
I want to export each and every sheet in excel worbook to indiviudal images in .png or .jpg format at best quality by clicking a button.On clicking of activeX button ,all the sheets should automatically saved as images files individually.

Say...
sheet 1 to be saved as image1.jpg
sheet 2 to be saved as image2.jpg
sheet 3 to be saved as image3.jpg
in this way.....

thank you in advance.
 
Amni

Firstly, Welcome to the Chandoo.org Forums

Your post has been cross-posted, which means it has been seen on other websites. This is considered poor practice, as it can waste peoples time, which could be spent elsewhere, especially if you get a solution and don't notify us.

I encourage you to please read the site rules at:
http://forum.chandoo.org/link-forums/new-users-please-read.17/

In regards your question:
Have a read of some solutions at:
https://stackoverflow.com/questions...xport-excel-worksheets-as-image-in-excel-2003
 
Last edited:
Hello Not really sure about why .jpg instead of PDF as the quality of PDF would be more clarity..
Try this code for quick start...Let me know.

Code:
Sub Demo()
Dim wks As Worksheet
Dim strName As String

Set wks = ActiveSheet
strName = InputBox("Enter name for pdf file:")

wks.ExportAsFixedFormat Type:=xlTypePDF, _
                        Filename:="D:\Monty\" & strName, _
                        Quality:=xlQualityStandard, _
                        OpenAfterPublish:=True

End Sub
 
The above code works only for one sheet which converts current sheet to pdf...but if you are looking for all the sheets in the workbook need to use for each loop to get this done..

Let me know any challenges...Happy to help you.
 
Try this based on the guess...as there is no sample up lode from you!

Code:
Sub Demo()
    Const FName As String = "D:\Monty\Pics.jpg"
    Dim pic_rng As Range
    Dim ShTemp As Worksheet
    Dim ChTemp As Chart
    Dim PicTemp As Picture
    Application.ScreenUpdating = False
    Set pic_rng = Worksheets("FileNameHere").Range("B1:F28") 'Set your range here
    Set ShTemp = Worksheets.Add
    Charts.Add
    ActiveChart.Location Where:=xlLocationAsObject, Name:=ShTemp.Name
    Set ChTemp = ActiveChart
    pic_rng.CopyPicture Appearance:=xlScreen, Format:=xlPicture
    ChTemp.Paste
    Set PicTemp = Selection
    With ChTemp.Parent
        .Width = PicTemp.Width + 8
        .Height = PicTemp.Height + 8
    End With
    ChTemp.Export Filename:="D:\Monty\Pics.jpg", FilterName:="jpg"
    Application.DisplayAlerts = False
    ShTemp.Delete
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
End Sub
 
can you place code in this attached file and send it back ,so that i can check it
 

Attachments

  • DF.xlsx
    11.7 KB · Views: 2
Back
Top