roscoe
Well-known Member
- Joined
- Jun 4, 2002
- Messages
- 1,062
- Office Version
- 365
- Platform
- Windows
- MacOS
I have the following code that takes a snapshot of a graph and drops in on the spreadsheet below the graph for easy visual compare before/after an update. It runs perfectly every time when I step (F8) though the editor. When I use F5 in the editor to run it full speed I get (the unhelpful) "Run-Time Error 1004, Application-define or Object-defined error".. When I run it from a macro-assigned "shape" on the spreadsheet as originally intended I get the infamous (and equally unhelpful) Error 400.
This code used to run fine from the spreadsheet every time, then over time the error began popping up intermittently (repeated attempts would usually work), now it happens almost every time (repeated attempts not working). I would think the code is OK (maybe not optimal) because it steps through every time in the editor.
Really needs ideas here.
Thanks!!
VBA Code:
Sub Copy_Graph()
Worksheets("Print Plot").ChartObjects("Chart 3").Select
Selection.Copy
Range("A30").Select
Activesheet.PasteSpecial Format:="Picture (Enhanced Metafile)", Link:=False, DisplayAsIcon:=False
End Sub
This code used to run fine from the spreadsheet every time, then over time the error began popping up intermittently (repeated attempts would usually work), now it happens almost every time (repeated attempts not working). I would think the code is OK (maybe not optimal) because it steps through every time in the editor.
Really needs ideas here.
Thanks!!