K
ker_01
Excel 2003, although I'd like my code to work in 2007 as well, in case I
up(?)grade.
I'm trying to export an autoshape as a picture (code below). The last line
returns a 438 error; "object does not support this property or method". I
welcome any suggestions on how to adjust the code to export an autoshape as
an image.
Overall plan- because you might have other good ideas for me to consider- I
want to use some 'custom' colors without using the color palette, but Excel
doesn't like that idea. At this point, I am trying to use only the last
custom color index; set it to my custom color, set the autoshape to that
color, save the autoshape as a picture; then change the custom color palette
back to what it was before I used it. Last, I import my autoshape as an
image, thereby retaining my custom color without requiring the ongoing use of
the palette.
My next step will be to import the "autoshape" image and try to place it
exactly where the autoshape was (and then delete the autoshape). I also need
to ensure that my image's background is transparent so that I can overlap
images and have it look the same as overlapped autoshapes.
Sub ExportShapeAsPicture()
Dim IShape As Shape
Err.Number = 0
On Error Resume Next
Set IShape = ActiveWorkbook.ActiveSheet.Shapes("AutoShape 9133")
If IShape Is Nothing Or Err.Number <> 0 Then
MsgBox "Whoops, no shape by this name"
Exit Sub
End If
ShapeName = "test_i1"
UsePath = ActiveWorkbook.Path & "\" & ShapeName & ".gif"
On Error GoTo 0
IShape.Export FileName:=UsePath, FilterName:="GIF"
End Sub
up(?)grade.
I'm trying to export an autoshape as a picture (code below). The last line
returns a 438 error; "object does not support this property or method". I
welcome any suggestions on how to adjust the code to export an autoshape as
an image.
Overall plan- because you might have other good ideas for me to consider- I
want to use some 'custom' colors without using the color palette, but Excel
doesn't like that idea. At this point, I am trying to use only the last
custom color index; set it to my custom color, set the autoshape to that
color, save the autoshape as a picture; then change the custom color palette
back to what it was before I used it. Last, I import my autoshape as an
image, thereby retaining my custom color without requiring the ongoing use of
the palette.
My next step will be to import the "autoshape" image and try to place it
exactly where the autoshape was (and then delete the autoshape). I also need
to ensure that my image's background is transparent so that I can overlap
images and have it look the same as overlapped autoshapes.
Sub ExportShapeAsPicture()
Dim IShape As Shape
Err.Number = 0
On Error Resume Next
Set IShape = ActiveWorkbook.ActiveSheet.Shapes("AutoShape 9133")
If IShape Is Nothing Or Err.Number <> 0 Then
MsgBox "Whoops, no shape by this name"
Exit Sub
End If
ShapeName = "test_i1"
UsePath = ActiveWorkbook.Path & "\" & ShapeName & ".gif"
On Error GoTo 0
IShape.Export FileName:=UsePath, FilterName:="GIF"
End Sub