ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how can i exports or save picture out of excel worksheet (https://www.excelbanter.com/excel-programming/316943-how-can-i-exports-save-picture-out-excel-worksheet.html)

dk_arya

how can i exports or save picture out of excel worksheet
 

i have followoing code for exporting a picture in excel worksheet but i
is showing me error as object does not support this method or proerties
plz help me to sort it out.


On Error GoTo ErrorHandler
'Dim p As Object
'Dim a As ChartObject
Dim objExcel As Excel.Application
Set objExcel = GetObject("Excel.Application")
If objExcel Is Nothing Then
Set objExcel = CreateObject("Excel.Application")
End If
objExcel.Workbooks.Open App.Path & "\PhotoOffer.xls"
objExcel.Interactive = True
objExcel.Visible = True
'objExcel.ActiveSheet.Shapes("Picture 2").Select
objExcel.ActiveSheet.pictures(2).Export App.Path & "\ab.gif"
Set objExcel = Nothing
Exit Sub
ErrorHandler:
If Err.Number < 432 Then
ShowError Err.Number, Err.Description, MODULE_NAME, "createExcel"
Set objExcel = Nothing
Exit Sub
Else
Resume Next
End I

--
dk_ary
-----------------------------------------------------------------------
dk_arya's Profile: http://www.excelforum.com/member.php...fo&userid=1651
View this thread: http://www.excelforum.com/showthread.php?threadid=31372


NickHK

how can i exports or save picture out of excel worksheet
 
dk_arya,
There are no such members as ".Pictures" or ".Export" in your line:
"objExcel.ActiveSheet.pictures(2).Export App.Path & "\ab.gif""
so this is always going to fail.

One way is to save your worksheet as a web page, which generates the picture
file for you.
There may be more direct ways also ??

NickHK


"dk_arya" wrote in message
...

i have followoing code for exporting a picture in excel worksheet but it
is showing me error as object does not support this method or proerties
plz help me to sort it out.


On Error GoTo ErrorHandler
'Dim p As Object
'Dim a As ChartObject
Dim objExcel As Excel.Application
Set objExcel = GetObject("Excel.Application")
If objExcel Is Nothing Then
Set objExcel = CreateObject("Excel.Application")
End If
objExcel.Workbooks.Open App.Path & "\PhotoOffer.xls"
objExcel.Interactive = True
objExcel.Visible = True
'objExcel.ActiveSheet.Shapes("Picture 2").Select
objExcel.ActiveSheet.pictures(2).Export App.Path & "\ab.gif"
Set objExcel = Nothing
Exit Sub
ErrorHandler:
If Err.Number < 432 Then
ShowError Err.Number, Err.Description, MODULE_NAME, "createExcel"
Set objExcel = Nothing
Exit Sub
Else
Resume Next
End If


--
dk_arya
------------------------------------------------------------------------
dk_arya's Profile:

http://www.excelforum.com/member.php...o&userid=16517
View this thread: http://www.excelforum.com/showthread...hreadid=313720





All times are GMT +1. The time now is 07:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com