Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
charlie6067 charlie6067 is offline
external usenet poster
 
Posts: 2
Default Two methods to insert autotext, yet different results. Why? Code enclosed

1. First Method:
I have written several macros to insert autotext that has some words
bolded, some not, in the paragraphs. The macros are triggered from a
custom drop-down tool bar menu I had made. When this method runs, no
bolding displays when the autotext inserts via the macro.

2. Second method:
If I manually insert the autotext from the Tools menu, the text inserts
with appropriate words formatted in bold.

Why does the second method give the desired results and the first
doesn't?

Here's the code from method one at the end of this message. I recorded
a keystroke macro so maybe there's extra code in it that's messing up
the desired result? Any help will be appreciated.

Thanks,
Charlie
charlie6067

Sub VOL_DEN()
'
' InsertCoverage Macro
' Macro recorded 07/28/06 by Charlie Johnson
'
PasswordOff
Application.DisplayAutoCompleteTips = False
With AutoCorrect
.CorrectInitialCaps = True
.CorrectSentenceCaps = True
.CorrectDays = True
.CorrectCapsLock = True
.ReplaceText = True
End With
ActiveDocument.AttachedTemplate.AutoTextEntries("1 1. VOLUNTARY
DENTAL"). _
Insert Whe=Selection.Range
PasswordOn
End Sub

  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Two methods to insert autotext, yet different results. Why? Code enclosed

In the Insert method call, you need to include the optional RichText
parameter and set it to True:

ActiveDocument.AttachedTemplate.AutoTextEntries("1 1. VOLUNTARY
DENTAL"). _
Insert Whe=Selection.Range, RichText:=True

If you have other macro-related questions, please post them to one of the
microsoft.public.word.vba newsgroups. This group is high-volume and your
question might be overlooked.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

charlie6067 wrote:
1. First Method:
I have written several macros to insert autotext that has some words
bolded, some not, in the paragraphs. The macros are triggered from a
custom drop-down tool bar menu I had made. When this method runs, no
bolding displays when the autotext inserts via the macro.

2. Second method:
If I manually insert the autotext from the Tools menu, the text
inserts with appropriate words formatted in bold.

Why does the second method give the desired results and the first
doesn't?

Here's the code from method one at the end of this message. I recorded
a keystroke macro so maybe there's extra code in it that's messing up
the desired result? Any help will be appreciated.

Thanks,
Charlie
charlie6067

Sub VOL_DEN()
'
' InsertCoverage Macro
' Macro recorded 07/28/06 by Charlie Johnson
'
PasswordOff
Application.DisplayAutoCompleteTips = False
With AutoCorrect
.CorrectInitialCaps = True
.CorrectSentenceCaps = True
.CorrectDays = True
.CorrectCapsLock = True
.ReplaceText = True
End With
ActiveDocument.AttachedTemplate.AutoTextEntries("1 1. VOLUNTARY
DENTAL"). _
Insert Whe=Selection.Range
PasswordOn
End Sub



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
charlie6067 charlie6067 is offline
external usenet poster
 
Posts: 2
Default Two methods to insert autotext, yet different results. Why? Code enclosed

Thanks Jay for the help.
Charlie
charlie6067

Jay Freedman wrote:
In the Insert method call, you need to include the optional RichText
parameter and set it to True:

ActiveDocument.AttachedTemplate.AutoTextEntries("1 1. VOLUNTARY
DENTAL"). _
Insert Whe=Selection.Range, RichText:=True

If you have other macro-related questions, please post them to one of the
microsoft.public.word.vba newsgroups. This group is high-volume and your
question might be overlooked.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

charlie6067 wrote:
1. First Method:
I have written several macros to insert autotext that has some words
bolded, some not, in the paragraphs. The macros are triggered from a
custom drop-down tool bar menu I had made. When this method runs, no
bolding displays when the autotext inserts via the macro.

2. Second method:
If I manually insert the autotext from the Tools menu, the text
inserts with appropriate words formatted in bold.

Why does the second method give the desired results and the first
doesn't?

Here's the code from method one at the end of this message. I recorded
a keystroke macro so maybe there's extra code in it that's messing up
the desired result? Any help will be appreciated.

Thanks,
Charlie
charlie6067

Sub VOL_DEN()
'
' InsertCoverage Macro
' Macro recorded 07/28/06 by Charlie Johnson
'
PasswordOff
Application.DisplayAutoCompleteTips = False
With AutoCorrect
.CorrectInitialCaps = True
.CorrectSentenceCaps = True
.CorrectDays = True
.CorrectCapsLock = True
.ReplaceText = True
End With
ActiveDocument.AttachedTemplate.AutoTextEntries("1 1. VOLUNTARY
DENTAL"). _
Insert Whe=Selection.Range
PasswordOn
End Sub


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert autotext doesn't work in header and footer Richard Microsoft Word Help 1 March 30th 05 06:39 PM
Header/Footer Insert Autotext disabled? MooseMan Microsoft Word Help 5 February 9th 05 03:38 AM
Insert > Autotext is missing "filename" and "filename and path"; how to get back? StargateFan New Users 7 February 7th 05 12:17 AM
simple word question rvance New Users 8 February 1st 05 02:16 AM
Using Hyperlinks in Mail Merge IF...THEN...ELSE Statements Mark V Mailmerge 8 November 30th 04 01:31 PM


All times are GMT +1. The time now is 03:36 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"