Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-30-2021, 03:40 PM
drrr drrr is offline Word 2019 macro not working error 4198 command failed Windows 10 Word 2019 macro not working error 4198 command failed Office 2019
Novice
Word 2019 macro not working error 4198 command failed
 
Join Date: Jul 2021
Posts: 9
drrr is on a distinguished road
Default Word 2019 macro not working error 4198 command failed

Sub Macro1()
'
' Macro1 Macro
'
'


Selection.Cut
Selection.TypeText Text:="{{c1::"
Selection.PasteAndFormat (wdFormatPlainText)
Selection.TypeText Text:="}}"
Selection.TypeParagraph
End Sub


it fails at the pasting stage
i tried the automatic paste and plainText paste but same failed result
Reply With Quote
  #2  
Old 08-02-2021, 12:22 AM
Guessed's Avatar
Guessed Guessed is offline Word 2019 macro not working error 4198 command failed Windows 10 Word 2019 macro not working error 4198 command failed Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Do you really want to lose fields, tables and graphics by pasting as plain text?

Perhaps another 'less destructive' way would be to remove formatting from the selection and insert text before and after it.
Code:
Sub Macro1()
  With Selection
    .ParagraphFormat.Reset
    .Font.Reset
    .Range.Style = ActiveDocument.Styles(wdStyleNormal)
    .InsertAfter "}}"
    .InsertBefore "{{c1::"
  End With
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply

Tags
macro

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
What's new in Word 2019, Excel 2019 and Outlook 2019 and Why upgrade to Office 2019 is recommended? einfomail Office 1 07-26-2019 09:44 AM
PgUp/PgDn not working as expected in Word 2019; macro workaround? AmyJSchneider Word VBA 0 01-19-2019 03:45 PM
Word 2019 macro not working error 4198 command failed Run-time error '-2147467259 (80004005)': Method 'Insert' of object 'BuildingBlock' failed Katherine1995 Word VBA 6 11-17-2016 12:04 PM
Word 2010 Run-Time error 4198 with Insert Picture with Caption and Fram Macro jstills116 Word VBA 0 06-24-2016 07:46 AM
Run time error - Pivot Cache Failed patrick1063 Excel Programming 0 02-08-2016 07:56 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:47 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft