JosjaWillems
Technical User
Hello,
I keep getting the following error while executing a macro:
"error 4605: This method or property is not available because the clipboard is empty or not valid"
Here is the code (and don't mind the Dutch words: they are irrelevant):
The error only comes up on lines like "wdApp.Selection.Paste". However, sometimes the error doesn't come up at all, and sometimes it comes up on a different paste-command.
I really can't figure it out. Unending gratitude to the one who can crack this
Kind regards,
Josh Williams
I keep getting the following error while executing a macro:
"error 4605: This method or property is not available because the clipboard is empty or not valid"
Here is the code (and don't mind the Dutch words: they are irrelevant):
Code:
Sub ExporteerParticuliereOfferte2()
Application.ScreenUpdating = False
Dim wd As Object
Set wdApp = CreateObject("Word.Application")
Set wd = wdApp.Documents.Add
wdApp.ScreenUpdating = False
wdApp.Visible = True
Sheets("ParticuliereOfferte2").Visible = True
Sheets("ParticuliereOfferte2").Select
If Cells(72, 1).Value = "" Then Cells(72, 1).EntireRow.Hidden = True
If Cells(73, 1).Value = "" Then Cells(73, 1).EntireRow.Hidden = True
'This code is repeated several times, but in order to make this easier to read, I left out most of 'em
Range("A39:A81").Select
Selection.Copy
wdApp.Selection.Paste
wdApp.Selection.EndKey
wdApp.Selection.TypeParagraph
Range("B1:C38").Select
Selection.Copy
wdApp.Selection.Paste
wdApp.Selection.EndKey
wdApp.Selection.TypeParagraph
Range("A83:A134").Select
Selection.Copy
wdApp.Selection.Paste
wdApp.Selection.GoTo What:=wdGoToLine, Which:=wdGoToAbsolute, Count:=1
Cells.Select
Selection.EntireRow.Hidden = False
Sheets("ParticuliereOfferte2").Visible = False
Sheets("Hoofdmenu").Select
Application.ScreenUpdating = True
wdApp.ScreenUpdating = True
wdApp.Activate
End Sub
The error only comes up on lines like "wdApp.Selection.Paste". However, sometimes the error doesn't come up at all, and sometimes it comes up on a different paste-command.
I really can't figure it out. Unending gratitude to the one who can crack this
Kind regards,
Josh Williams