![]() |
|
|
|
#1
|
|||
|
|||
|
Neither site contains any virus. These are old web pages and have been used safely for many years. What led you to believe that either was infected?
Do you understand the concept of the Style Separator? If not, you need to learn it. The macro recorder is often unable to reproduce things that you do. If your heading styles are "linked," attempting to apply the style to selected text is going to apply a poor-relation to that style, a quasi-character style, to the text. What, exactly, step-by-step, is it you want your macro to do? Why? What do you hope to accomplish by doing this? |
|
#2
|
|||
|
|||
|
Quote:
Quote:
Quote:
I am pasting the current macro code below. Before running the macro, the user would select the freestanding heading (and any white space to the right of that heading). The macro places a period at the end of that text, brings the following paragraph up to join it, and, ideally would apply the Heading 3 style to the text before the period and the Body Text style to the remainder of the paragraph. I'm not sure if that is clear, but I can make a video if it is not. Code:
Sub ChangeAPA2toAPA3()
'
' ChangeAPA2toAPA3 Macro
' Changes from freestanding APA 2 level subhead to run-in APA level 3 subhead. Uses BodyText style to define the paragraph style.
'
Selection.ClearFormatting
Selection.Style = ActiveDocument.Styles("Body Text")
Selection.Range.Case = wdLowerCase
Selection.Range.Case = wdTitleSentence
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeBackspace
Selection.TypeText Text:=". "
Selection.MoveLeft Unit:=wdCharacter, Count:=2
Selection.HomeKey Unit:=wdLine, Extend:=wdExtend
Selection.Style = ActiveDocument.Styles("Heading 3")
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.Font.Bold = wdToggle
End Sub
|
|
| Tags |
| heading styles, macro, recorder |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Applying heading style to multiple pages at once | jane.bugai | Word | 5 | 02-24-2017 04:05 PM |
Using heading style level in a paragraph
|
kam | Word | 7 | 03-24-2014 02:58 PM |
Macro to replace one specific heading style with another
|
ubns | Word VBA | 44 | 09-04-2012 08:17 PM |
Applying style to first part of paragraph
|
foxtrot | Word | 3 | 07-24-2012 07:30 AM |
| Character style stripped while applying paragraph style | sams_gates | Word | 0 | 08-29-2009 02:03 AM |