G
gfox
Hi,
I'm trying to write a macro that is compatible with Word 2000+ that paste
some text matching the surrounding formatting, or simply paste as HTML if
Word does not support this feature.
I've tryied writing this:
Sub PasteAndFormat()
On Error GoTo error
Selection.PasteAndFormat (wdFormatSurroundingFormattingWithEmphasis)
error:
' If error, simply paste it as HTML
Call PasteAsHTML
End Sub
which triggers a "Method or data member not found" on Word 2000, as the
Selection object has no PasteAndFormat method and the On Error statement does
not provide much help in this case.
Ideally, i would like to test if the object "Selection" has a
"PasteAndFormat" method before trying to call it...
How would you do this?
(is there any workaroud to detect the version of Word, so i would not try to
execute this code if my client has got Word 2000?)
I'm trying to write a macro that is compatible with Word 2000+ that paste
some text matching the surrounding formatting, or simply paste as HTML if
Word does not support this feature.
I've tryied writing this:
Sub PasteAndFormat()
On Error GoTo error
Selection.PasteAndFormat (wdFormatSurroundingFormattingWithEmphasis)
error:
' If error, simply paste it as HTML
Call PasteAsHTML
End Sub
which triggers a "Method or data member not found" on Word 2000, as the
Selection object has no PasteAndFormat method and the On Error statement does
not provide much help in this case.
Ideally, i would like to test if the object "Selection" has a
"PasteAndFormat" method before trying to call it...
How would you do this?
(is there any workaroud to detect the version of Word, so i would not try to
execute this code if my client has got Word 2000?)