0

I have charts in excel that I copy and pass to an external picture manager with flags by the Shell command to save each chart as a gif. In Excel 2003 it works fine, but in 2016 it fails. I have tried wrapping the string with double quotes even there is no space in it, no luck. However, if I print out the string with debug.print ShComd and input that, then it works in 2016, like:

ShComd="C:\IrfanView\i_view32.exe ... =C:\Test\Sheet1.gif /killmesoftly"

So this fails only in 2016 in row PID = ... with wrong argument

ShComd = i_view_Path & "\i_view32.exe /clippaste /convert=" _
& SavePath & "\" & Sht.Name & ".gif /killmesoftly"   
For Each Chrt In Sht.ChartObjects
    Chrt.Copy
    DoEvents
    Sleep (250) 'start up irfanview to avoid "Can't Load"
    PID = Shell(ShComd) 'fails here in 2016
Next Chrt

How come?

Pᴇʜ
  • 56,719
  • 10
  • 49
  • 73
Billy
  • 3
  • 3

1 Answers1

0

Billy, I'd first reference the library, Windows Script Host Object Model. Then, use the Run method. And, most important for your concern, separate the multiple commands with " && "

You can see here.

J VBA
  • 178
  • 2
  • 5