Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-31-2011, 06:58 AM
Jana Jana is offline Please help copy inside brackets Windows 7 32bit Please help copy inside brackets Office 2007
Novice
Please help copy inside brackets
 
Join Date: Dec 2011
Posts: 28
Jana is on a distinguished road
Default Please help copy inside brackets


Is there any way to take the text of specific heading numbers and to take to the previous heading text inside brackets separated by · before the last full stop. I need something to take the title to copy inside brackets and if more than one headings to seperated by comma and end to a fullstop.
Attached Files
File Type: docx Document without formation.docx (16.4 KB, 18 views)
File Type: docx Document after formation.docx (16.7 KB, 10 views)
Reply With Quote
  #2  
Old 12-31-2011, 09:16 PM
macropod's Avatar
macropod macropod is offline Please help copy inside brackets Windows 7 64bit Please help copy inside brackets Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Jana,

So what you want is for each heading 3 to be repeated at the end of the 2nd physical (1st logical) paragraph after the corresponding heading 2 - and for the heading 3 entries thus repeated to be separated by commas and, as a group, enclosed in braces? If so, most of what you want can by done by inserting cross-references to the heading 3 paragraphs at the appropriate point. This has the advantage that they'll update if the heading content changes. If you have a lot of these, it could be automated via a macro.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 01-01-2012, 02:51 AM
Jana Jana is offline Please help copy inside brackets Windows 7 32bit Please help copy inside brackets Office 2007
Novice
Please help copy inside brackets
 
Join Date: Dec 2011
Posts: 28
Jana is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Hi Jana,

So what you want is for each heading 3 to be repeated at the end of the 2nd physical (1st logical) paragraph after the corresponding heading 2 - and for the heading 3 entries thus repeated to be separated by commas and, as a group, enclosed in braces? If so, most of what you want can by done by inserting cross-references to the heading 3 paragraphs at the appropriate point. This has the advantage that they'll update if the heading content changes. If you have a lot of these, it could be automated via a macro.

I have a lot of this, thats for sure!!! No i dont want to add crossreferences because already included and maybe cause problem. I need to add these inside brackets.
Reply With Quote
  #4  
Old 01-01-2012, 03:58 AM
macropod's Avatar
macropod macropod is offline Please help copy inside brackets Windows 7 64bit Please help copy inside brackets Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Jana,

I'm not sure what problems you're anticipating by inserting cross-references within the braces. The most I'd expect is that, if the heading gets deleted, the cross-reference would generate an error message. Being readily recognised, that may be better than having output that still refers to a deleted heading.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 01-01-2012, 04:51 AM
Jana Jana is offline Please help copy inside brackets Windows 7 32bit Please help copy inside brackets Office 2007
Novice
Please help copy inside brackets
 
Join Date: Dec 2011
Posts: 28
Jana is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Hi Jana,

I'm not sure what problems you're anticipating by inserting cross-references within the braces. The most I'd expect is that, if the heading gets deleted, the cross-reference would generate an error message. Being readily recognised, that may be better than having output that still refers to a deleted heading.
Its not usefull for us to make as crossreference makropod. We need to put the clues inside brackets. We dont wont that because we never delete text. The text is allready set up and after that we need to formation properly. Thanks for your reply.
Reply With Quote
  #6  
Old 01-01-2012, 06:34 PM
macropod's Avatar
macropod macropod is offline Please help copy inside brackets Windows 7 64bit Please help copy inside brackets Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Jana,

Try the following macro:
Code:
Sub InsertRefs()
Application.ScreenUpdating = False
Dim RngHd2 As Range, RngHd3 As Range, RngRef As Range, oPara As Paragraph
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = ""
    .Style = "Heading 2"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Execute
  End With
  Do While .Find.Found
    Set RngHd2 = .Paragraphs(1).Range.Duplicate
    With RngHd2
      On Error GoTo ParaLast
      While .Paragraphs.Last.Next.Style <> "Heading 1" And .Paragraphs.Last.Next.Style <> "Heading 2"
        .MoveEnd wdParagraph, 1
      Wend
ParaLast:
      If .Paragraphs.Count > 2 Then
        Set RngRef = RngHd2.Paragraphs(3).Range.Characters.Last
        .MoveStart wdParagraph, 3
        Set RngHd3 = RngHd2
        With RngRef
          .MoveEnd wdCharacter, -1
          .InsertAfter " { "
          For Each oPara In RngHd3.Paragraphs
            If oPara.Style = "Heading 3" Then
              If Len(Trim(oPara.Range.Text)) > 1 Then
                .InsertAfter Left(oPara.Range.Text, Len(oPara.Range.Text) - 1) & ", "
              End If
            End If
          Next
          .Characters.Last.Previous.Delete
          .InsertAfter "}."
        End With
      End If
    End With
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 01-02-2012, 03:31 AM
Jana Jana is offline Please help copy inside brackets Windows 7 32bit Please help copy inside brackets Office 2007
Novice
Please help copy inside brackets
 
Join Date: Dec 2011
Posts: 28
Jana is on a distinguished road
Default Error Compile

I try to execute this code but the execution returns compile error. So, I try to see the code and a yellow text Subinsertrefs(), also the line Dim RngHd2 As Range, RngHd3 As Range, RngRef As Range, oPara As Paragraph With ActiveDocument.Range looks like with red lettering. Maybe a problem with that too.
Reply With Quote
  #8  
Old 01-02-2012, 03:41 AM
macropod's Avatar
macropod macropod is offline Please help copy inside brackets Windows 7 64bit Please help copy inside brackets Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Jana,

That suggests you haven't copied & pasted the code correctly. What did the 'Compile Error' message say was the problem? You need to be especially careful that the copied & pasted code has exactly the same content and layout as in my post.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 01-02-2012, 04:22 AM
Jana Jana is offline Please help copy inside brackets Windows 7 32bit Please help copy inside brackets Office 2007
Novice
Please help copy inside brackets
 
Join Date: Dec 2011
Posts: 28
Jana is on a distinguished road
Default Error 5834

Quote:
Originally Posted by macropod View Post
Hi Jana,

That suggests you haven't copied & pasted the code correctly. What did the 'Compile Error' message say was the problem? You need to be especially careful that the copied & pasted code has exactly the same content and layout as in my post.
Heading 2 yellow error.
Reply With Quote
  #10  
Old 01-02-2012, 04:26 AM
macropod's Avatar
macropod macropod is offline Please help copy inside brackets Windows 7 64bit Please help copy inside brackets Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Jana,

That error does not occur if you run the code on the document attached to your previous post.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #11  
Old 01-02-2012, 04:43 AM
Jana Jana is offline Please help copy inside brackets Windows 7 32bit Please help copy inside brackets Office 2007
Novice
Please help copy inside brackets
 
Join Date: Dec 2011
Posts: 28
Jana is on a distinguished road
Default Ha ha!!! Not we take the same problem

Quote:
Originally Posted by macropod View Post
Hi Jana,

That error does not occur if you run the code on the document attached to your previous post.
Still yellow color. Look the document.
Attached Files
File Type: docx Document without formation.docx (16.8 KB, 12 views)
Reply With Quote
  #12  
Old 01-02-2012, 04:47 AM
macropod's Avatar
macropod macropod is offline Please help copy inside brackets Windows 7 64bit Please help copy inside brackets Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I get no error and the code executes correctly!
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #13  
Old 01-02-2012, 05:33 AM
Jana Jana is offline Please help copy inside brackets Windows 7 32bit Please help copy inside brackets Office 2007
Novice
Please help copy inside brackets
 
Join Date: Dec 2011
Posts: 28
Jana is on a distinguished road
Default Dear Macropod

Quote:
Originally Posted by macropod View Post
I get no error and the code executes correctly!
I dont understand what misunderstand, i still get this error. Maybe something i ve done before. But still not working for me. Whats the problem with that?
Reply With Quote
  #14  
Old 01-02-2012, 02:52 PM
macropod's Avatar
macropod macropod is offline Please help copy inside brackets Windows 7 64bit Please help copy inside brackets Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Jana,

Try the attached. It''s your original 'without formation' document with the macro added and zipped (we can't add docm attachments). It works for me.
Attached Files
File Type: zip Jana (1).zip (18.6 KB, 13 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #15  
Old 01-02-2012, 03:34 PM
Jana Jana is offline Please help copy inside brackets Windows 7 32bit Please help copy inside brackets Office 2007
Novice
Please help copy inside brackets
 
Join Date: Dec 2011
Posts: 28
Jana is on a distinguished road
Default Macropod thanks very much for your help

Quote:
Originally Posted by macropod View Post
Hi Jana,

Try the attached. It''s your original 'without formation' document with the macro added and zipped (we can't add docm attachments). It works for me.
Please i tried again and the heading 2 is still yellow. Maybe is problem with my word processor.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Gray square brackets waldux Word 8 09-25-2013 04:14 PM
Please help copy inside brackets Find/Replace Brackets Problem fatso Word 2 08-04-2011 11:34 AM
brackets citation uncung Word 1 07-13-2011 01:39 PM
Brackets Issue... DarkJudge1 Outlook 0 07-06-2010 05:15 PM
copy a file which does not have copy option jkind Word 0 01-17-2010 09:25 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:11 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