We are trying to run BOT which is consists of a macro. To run that macro we are just clicking on a button(available on excel sheet) which invokes macro internally which pulls data from database and paste it on different sheets of same excel.
It is working exactly as per expectation but sometimes it throws an error like while pasting graphs from one sheet to another
“Runtime Error 1004 Microsoft excel can not paste the data”
When we tried to run manually , we had never faced this exception, This is very inconsistent exception message which we are getting.
Exception is occurring on below macro code
activesheet.Picture.Paste.Select
We are struggling with this issue, please let us know in case if you have any idea or workaround.
EDIT: Actually - how many instances of excel do you have open? Try closing all instances and then running the bot which executes the macro, it may be due to multiple instances of excel open.
Macro code is already written by another team which is very lengthy and we are just clicking on RUN button which is available on excel sheet which internally invoke macro.
Same is running perfectly fine when we are running manually, but it throws that error sometime. occurrences of error is also inconsistent.
Error:-
“Runtime Error 1004 Microsoft excel can not paste the data”