Bonjour a tous,
Mon programme me pose des problèmes.
Il génére :
«Erreur d’exécution ‘-2147417848(80010108)’ : La méthode ‘PasteSpecial de l’objet ‘Range’ a échoué. »
De plus a la fermeture du fichier : "Cette image est trop grande et va être tronquée."
Il y a de nombreux copier/ coller dans le code et depuis je tente de vider le presse papier selon différentes instructions mais rien ni fait, soit les instructions sont incomplètes soit le problème est ailleurs.
Je cherche donc une solution.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62 Private Declare Function OpenClipboard Lib "user32" _ (ByVal hwnd As Long) As Long Private Declare Function EmptyClipboard Lib "user32" () As Long Private Declare Function CloseClipboard Lib "user32" () As Long ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub vide() On Error Resume Next Application.CommandBars("Clipboard").Controls(4).Execute End Sub '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub Vider() OpenClipboard 0 EmptyClipboard CloseClipboard End Sub '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub ClearClipboard() Dim oDataObject As DataObject Set oDataObject = New DataObject oDataObject.SetText "" oDataObject.PutInClipboard Set oDataObject = Nothing End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub ESSAIS() Deb = Timer Application.ScreenUpdating = False For I = 1 To 20 decal = 45 * I Application.CutCopyMode = False Application.Run "'Stade2&5.xlsm'! vide" Application.Run "'Stade2&5.xlsm'! Vider" Sheets("A").Range("A20:AS1139").Offset(0, decal).Copy Sheets("1").Range("A20").PasteSpecial Paste:=xlPasteValues Application.Run "'Stade2&5.xlsm'!TestX14" Application.Run "'Stade2&5.xlsm'! vide" Application.Run "'Stade2&5.xlsm'! Vider" Application.Run "'Stade2&5.xlsm'! ClearClipboard" Range("BA20:BA1139").Copy Range("DE20").Offset(0, I).PasteSpecial Paste:=xlPasteValues Range("BE17:CX17").Copy Range("EF1").Offset(I - 1, 0).PasteSpecial Paste:=xlPasteValues Next I Application.ScreenUpdating = True Application.CutCopyMode = True ActiveWorkbook.Save MsgBox "J'ai bossé " & Timer - Deb & " seconde" End Sub
Partager