Run Time Error '1004' PasteSpecial method of worksheet class failed

Nelson78

Active Member
Joined
Sep 11, 2017
Messages
492
Office Version
  1. 2007
Hello everybody.

I'm grasping datas from a website via vba, but I'm struggling with the

Run Time Error '1004' PasteSpecial method of worksheet class failed

This is the impacted part of the code:

Code:
    IE.ExecWB 17, 0            ' SelectAll
    IE.ExecWB 12, 2            ' Copy selection
    ActiveSheet.PasteSpecial Format:="Text", link:=False, DisplayAsIcon:=False
    Range("A1").PasteSpecial

The code selects all correctly (I see the highlighted page).

The error is, of course, on the following line:

Code:
ActiveSheet.PasteSpecial Format:="Text", link:=False, DisplayAsIcon:=False

Any ideas?
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

mole999

Well-known Member
Joined
Oct 23, 2004
Messages
10,524
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. Windows
so what does Activesheet point to when due to paste, 1004 usually indicates something is missing, you have NO range identified !
 

Nelson78

Active Member
Joined
Sep 11, 2017
Messages
492
Office Version
  1. 2007
In this way the same error:

Code:
Workbooks("Cartel1").Worksheets("Sheet 1").PasteSpecial Format:="Text", link:=False, DisplayAsIcon:=False

Could it be a problem of a large amount of datas?
 

Nelson78

Active Member
Joined
Sep 11, 2017
Messages
492
Office Version
  1. 2007
Removing the line with the error, it seems to work.
But I don't know if I can remove link and images.

Code:
    IE.ExecWB 17, 0            ' SelectAll
    IE.ExecWB 12, 2            ' Copy selection
    
    Range("A1").PasteSpecial
 

mole999

Well-known Member
Joined
Oct 23, 2004
Messages
10,524
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. Windows
what would
Workbooks("Cartel1").Worksheets("Sheet 1").range("a1").PasteSpecial Format:="Text", link:=False, DisplayAsIcon:=False

Do
 

Nelson78

Active Member
Joined
Sep 11, 2017
Messages
492
Office Version
  1. 2007
Above the attempts:

1)
Code:
Workbooks("Cartel1").Worksheets("Sheet 1").Range("a1").PasteSpecial Format:="Text", link:=False, DisplayAsIcon:=False
Run Time Error 1004 'Application Defined or Object Defined Error'

2)
Code:
Range("a1").PasteSpecial Format:="Text", link:=False, DisplayAsIcon:=False
Compile error: can't find predefined argument
(or something like this, I haven't found the exact translation in english)
highlighting on
Code:
Format:=

3)
Code:
Range("a1").PasteSpecial

This is ok but with the legacy of links and images.
 
Last edited:

Forum statistics

Threads
1,148,108
Messages
5,744,876
Members
423,907
Latest member
zerocool88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top