CopyPicture method of Picture Class failed error

Brass Contributor

Hello All,

I'm facing Run time error 1004 sometime when I run code & sometime code works perfectly.

for few user code run but few user face this issue. earlier it was working fine for all.

when I debug it it breaks at Selection.Copypictue

not sure how to solve it can someone please help.

Sumit_Bhokare_0-1712983997170.png

Sumit_Bhokare_1-1712984081850.png

 

@Hans Vogelaar 

7 Replies

@Sumit_Bhokare 

Does it work better if you replace the first 4 lines from your screenshot with

    thisWb.Worksheets("Item Details").Shapes("Picture 1").CopyPicture

@Hans Vogelaar It works well for me but my team member faces issue.

same thing happened earlier as well. sometimes it works fine, not sure what exactly is issue.

@Sumit_Bhokare 

As a test, insert the following lines above the CopyPicture line:

 

Application.CutCopyMode = False

DoEvents

 

and below it:

 

DoEvents

@Hans Vogelaar 

I have updated code as per suggestion & its almost working for all member except one or two member :(

getting error as below with one

 

Is something wrong in paste action? need to paste in any other way? should I use .pastespecial instead of .paste?

Sumit_Bhokare_0-1713245677757.png

 

@Sumit_Bhokare 

Try adding another DoEvents above ActiveSheet.Paste

@Hans Vogelaar do I need to add it after paste action as well?

with DoEvents above ActiveSheet.Paste still getting paste action error.

@Sumit_Bhokare 

I'm afraid I'm out of ideas. Sorry!