Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Thu, 4 Sep 2008 09:44:45 +0100,    group: microsoft.public.word.vba.general        back       


Moving Document Section   
Hi

How can I using VBA move a Section of a Word Document.

Regards

D
date: Thu, 4 Sep 2008 09:44:45 +0100   author:   DMc2007

Re: Moving Document Section   
Dim sCurSection As String
sCurSection = Selection.Information(wdActiveEndSectionNumber)
ActiveDocument.Sections(sCurSection).Range.Select

will select the current section. Where do you want to move it to?

-- 
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


DMc2007 wrote:
> Hi
>
> How can I using VBA move a Section of a Word Document.
>
> Regards
>
> D
date: Thu, 4 Sep 2008 12:35:57 +0300   author:   Graham Mayor

Re: Moving Document Section   
Say if I have got ten sections in a document, i would want to move section 3 
to before section 6.

Regards

D

"Graham Mayor"  wrote in message 
news:uS2WgGnDJHA.3636@TK2MSFTNGP02.phx.gbl...
> Dim sCurSection As String
> sCurSection = Selection.Information(wdActiveEndSectionNumber)
> ActiveDocument.Sections(sCurSection).Range.Select
>
> will select the current section. Where do you want to move it to?
>
> -- 
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor -  Word MVP
>
> My web site www.gmayor.com
> Word MVP web site http://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
>
> DMc2007 wrote:
>> Hi
>>
>> How can I using VBA move a Section of a Word Document.
>>
>> Regards
>>
>> D
>
>
date: Thu, 4 Sep 2008 11:29:06 +0100   author:   DMc2007

Re: Moving Document Section   
With ActiveDocument
    .Sections(3).Range.Cut
    .Sections(5).Range.Select
    With Selection
        .Collapse wdCollapseStart
        .Paste
    End With
End With

Note that when you have cut section 3, section 6 would then be section 5. 
When Section 3 is placed in its new position *it* will then be section 5 and 
Section 6 will again be Section 6


-- 
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>




DMc2007 wrote:
> Say if I have got ten sections in a document, i would want to move
> section 3 to before section 6.
>
> Regards
>
> D
>
> "Graham Mayor"  wrote in message
> news:uS2WgGnDJHA.3636@TK2MSFTNGP02.phx.gbl...
>> Dim sCurSection As String
>> sCurSection = Selection.Information(wdActiveEndSectionNumber)
>> ActiveDocument.Sections(sCurSection).Range.Select
>>
>> will select the current section. Where do you want to move it to?
>>
>> --
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>> Graham Mayor -  Word MVP
>>
>> My web site www.gmayor.com
>> Word MVP web site http://word.mvps.org
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>
>>
>> DMc2007 wrote:
>>> Hi
>>>
>>> How can I using VBA move a Section of a Word Document.
>>>
>>> Regards
>>>
>>> D
date: Thu, 4 Sep 2008 14:08:04 +0300   author:   Graham Mayor

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us