how can i exports or save picture out of excel worksheet

D

dk_arya

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
 
N

NickHK

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top