#1
|
|||
|
|||
Problem with quick parts
Hi there. I am trying to use this feature to replace a text with another.
I have already selected the text and went to quicks parts/autotext/save selection to autotext gallery However when I run the macro, I got the error 5941, telling that the element doesn't exist. I checked the name used to save the selected text and it is correct, so I dont know what is the problem. The macro is the following: Sub Document_Open() SubstitutePage End Sub Sub AutoOpen() SubstitutePage End Sub Sub SubstitutePage() ActiveDocument.Content.Select Selection.Delete ActiveDocument.AttachedTemplate.AutoTextEntries("a ne").Insert Where:=Selection.Range, RichText:=True End Sub |
#2
|
||||
|
||||
Change the code to
Code:
Sub SubstitutePage() ActiveDocument.Content.Delete ActiveDocument.AttachedTemplate.AutoTextEntries("a ne").Insert _ Where:=ActiveDocument.Range, _ RichText:=True End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Quick Tables disappear when emailed - quick parts / building blocks | silawtz | Word | 5 | 11-03-2022 07:44 PM |
Quick Parts-Need to be removed from TOC | Isaac | Word | 3 | 05-11-2017 04:43 AM |
Quick Parts Fields? | brucemc777 | Word | 2 | 02-16-2016 12:57 PM |
Quick Parts | tmneal74 | Word | 1 | 11-13-2012 06:04 PM |
Quick parts in doc file | alokmay | Word | 1 | 06-14-2011 04:46 PM |