Below is Example How to Use:Code:Sub ExportImageinExceltoADrive(strsheetName As String, strPicName As String, strPathtoSavewithImageName As String) Dim chtTempChart As ChartObject With ThisWorkbook.Worksheets(strsheetName) Set chtTempChart = .ChartObjects.Add(500, 500, 500, 350) With chtTempChart.Chart .ChartType = xlLine .Location Where:=xlLocationAsObject, Name:=strsheetName .HasLegend = False End With .Shapes(strPicName).Copy chtTempChart.Activate chtTempChart.Chart.Paste chtTempChart.Chart.Export Filename:=strPathtoSavewithImageName, FilterName:="jpeg" chtTempChart.Delete End With End Sub
Code:Sub ExportExample() Dim strPath As String Dim strSheet As String Dim strPicName As String '========Sheet Name where Image is========================================== strSheet = "3333" '=========================================================================== '=======Image Name========================================================== strPicName = "Picture 10" '=========================================================================== '=======Path where you want to Save this Image with Image Name============== '==============You can write any name in Place of "Background-16"=========== strPath = "K:\ExcelFox\Background-16.jpg" '=========================================================================== Call ExportImageinExceltoADrive(strSheet, strPicName, strPath) End Sub




Reply With Quote
Bookmarks