Issues exporting Shape to iimage file

pbassett

Active Member
Joined
May 5, 2004
Messages
358
I am automating the process of creating 50+ Org Charts images but often they are empty.
I traced this to the commented step below. If I break there and then press F5 to continue the code, it creates the image.
But if I don't break then many images end up 2KB in size, which is empty.
Does anyone have a tip to replicate what the breakpoint does?

Code:
    Dim shp As Shape, sht As Worksheet
    Dim chtObj As ChartObject
    Dim objTemp As Object
    Dim objPicTemp As Object

    For Each shp In ActiveSheet.Shapes
        If shp.Type = msoSmartArt Then
            Call ConfigureShape(shp)
            Set objTemp = shp
        End If
    Next shp

    Set sht = Workbooks("GraphicsExporter.xlam").Worksheets("PicHolder")
    Set chtObj = sht.ChartObjects(1)
    Do While Not Application.Ready: Sleep 10000: Loop
    objTemp.Copy
    Do While Not Application.Ready: Sleep 10000: Loop       ' Image size is 2KB unless manually step over this
    Set objPicTemp = ActiveSheet.Pictures.Paste
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
It still fails, although now it's starting to fail earlier when I set the SmartArtLayout variable:

Code:
Set ogSALayout = Application.SmartArtLayouts("urn:microsoft.com/office/officeart/2005/8/layout/pictureOrgChart")

The error is
Code:
Error -2147024809: The index into the specified collection is out of bounds.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top