A
Alex St-Pierre
Hi,
Sometimes, I get an error when I try to copy a table in excel and paste it
into Word. Normally, there's no error or if there's an error, the second
time, it will work. For some user, it doesn't work (even after 10 try). Does
anyone have an idea? It seems to be related to specific computer (the macro
run if I run it from a server or another computer).
Thank you!
Alex
iErr = 0
On Error Resume Next
300: ThisWorkbook.Activate
Err.Clear
oXlRng.Copy
docWord.Activate
iP = docWord.Paragraphs.Count
Set oRange = docWord.Paragraphs(iP).Range
oRange.PasteExcelTable LinkedToExcel:=False, WordFormatting:=False,
RTF:=False
If Err = 4605 Then
iErr = iErr + 1
If iErr = 10 Then
MsgBox "Error creating " & sTitle1, vbExclamation, "Message"
Exit Function
End If
GoTo 300
End If
On Error GoTo 0
Sometimes, I get an error when I try to copy a table in excel and paste it
into Word. Normally, there's no error or if there's an error, the second
time, it will work. For some user, it doesn't work (even after 10 try). Does
anyone have an idea? It seems to be related to specific computer (the macro
run if I run it from a server or another computer).
Thank you!
Alex
iErr = 0
On Error Resume Next
300: ThisWorkbook.Activate
Err.Clear
oXlRng.Copy
docWord.Activate
iP = docWord.Paragraphs.Count
Set oRange = docWord.Paragraphs(iP).Range
oRange.PasteExcelTable LinkedToExcel:=False, WordFormatting:=False,
RTF:=False
If Err = 4605 Then
iErr = iErr + 1
If iErr = 10 Then
MsgBox "Error creating " & sTitle1, vbExclamation, "Message"
Exit Function
End If
GoTo 300
End If
On Error GoTo 0