View Single Post
 
Old 08-21-2017, 07:41 AM
cheech1981 cheech1981 is offline Windows 7 64bit Office 2010 64bit
Advanced Beginner
 
Join Date: Nov 2011
Location: New Jersey, USA
Posts: 77
cheech1981 is on a distinguished road
Default

Quote:
Originally Posted by Charles Kenyon View Post
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?
Sorry Charles--it was very odd. I clicked on the link my antispyware program gave me a warning message. Then, when I tried to replicate the issue, I had no issue. Not sure what the problem was, but maybe I already had something. I just ran a clean just to be safe but, like you said, I'm sure it wasn't your site, and I apologize for the misunderstanding.

Quote:
Originally Posted by Charles Kenyon View Post
Do you understand the concept of the Style Separator? If not, you need to learn it.
I can successfully create a heading style at the beginning of the paragraph (e.g., Heading 3) while maintaining another style for the rest of the paragraph (e.g., Body Text). I would like to do this through a macro though, rather than doing it manually.

Quote:
Originally Posted by Charles Kenyon View Post
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?
I format documents that have a freestanding, flush-left heading style, and, sometimes, those headings must be changed to a run-in heading at the beginning of the paragraph below (think changing an APA 2 subheading to an APA 3 subheading). I can just do this manually if it is a few of them, but often I have to do it 50 times or so in a document. So I have set up a macro that does this, but the recorder does not seem to be recording the action of applying the Heading 3 style to the first bit of text.

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
Reply With Quote