excel vba copy-paste a shape and saveas 1004 error -
i'm experiencing 1004 runtime error when saving workbook (wbk_new) on copy-pasted group of shapes workbook (wbk_old). should tell macro wbk_old assigned group.
wbk_old.worksheets("dashboard").activate charttop = activesheet.shapes("group_vesselgraphics").top chartleft = activesheet.shapes("group_vesselgraphics").left activesheet.shapes("group_vesselgraphics").onaction = "" activesheet.shapes("group_vesselgraphics").copy wbk_new.worksheets("dashboard").activate activesheet.shapes("group_vesselgraphics").delete activesheet.paste activesheet.shapes("group_vesselgraphics").top = charttop activesheet.shapes("group_vesselgraphics").left = chartleft activesheet.shapes("group_vesselgraphics").onaction = "'" & activeworkbook.name & "'!updateshipgraph" wbk_old.close wbk_new.saveas path_old
i can't figure out causing error...does have faced issue ?
thanks ton !
(i forgot mention chart belong group of shapes!)
ok, don't understand why seems links still existing between "wbk_new" , "wbk_old" although broke links , updated chart refer intrinsic data. hence, closing of "wbk_old" couldn't performed , wbk_new became corrupted, impossible save it.
the way found work around issue save (on itself) wbk_new before closing wbk_old , call external process replace wbk_old wbk_new, using delay of 4s, , close wbk_new , old before delay completed. have admit ugly solution, if knows better way nice share it!
here below code of solution, batchcmd creates batch file of command , shell it:
{code above} wbk_new.save cmd = "ping -n 4 127.0.0.1 >nul" + vbcrlf cmd = cmd + "move /y " & path_new & " " & path_old call batchcmd(cmd, status:=vbhide) wbk_old.close wbk_new.close
Comments
Post a Comment