Berlie was telling us:
Berlie nous racontait que :
> I have some macro code that in part created a new section then unlinks
> the section's footers from the previous section.
[quoted text clipped - 27 lines]
>
> Any ideas?
Make sure that this person's working document is identical to yours when
you compare things.
I often (after hours of frustrating bug hunting) find that users try to use
code in a fashion that does not make sense.
In your case, what if this person is using the code from the first section
in the document? There is nothing to link to before...
If this turns out to be the reason, modify your code to add "idiot proof"
messages, like "You cannot unlink to the previous section when you are in
the first section..."
(I know it is tempting to add "... idiot" or some other expletive, but I
find it is better not to, especially if you want repeat customers!)

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Berlie - 03 Feb 2007 22:05 GMT
Thanks for your reply. I have walked the person through what they were
doing step by step on the phone and duplicated it on my computer. She
got the error and I did not. I haven't figured it out yet but she
tried it on another computer on her end and it is working for her on
that machine. /shrug
> Berlie was telling us:
> Berlie nous racontait que :
[quoted text clipped - 54 lines]
>
> - Show quoted text -
Berlie - 26 Feb 2007 16:11 GMT
The user is still seeing this erro on her work machine but not her
home one. I have changed the code to the following:
Selection.InsertBreak Type:=wdSectionBreakOddPage
ActiveDocument.Range(Start:=Selection.Start,
End:=ActiveDocument.Content.End).PageSetup.VerticalAlignment =
wdAlignVerticalTop
Dim pHeadFoot As Word.HeaderFooter
With Selection.Sections(1)
For Each pHeadFoot In .Footers
pHeadFoot.LinkToPrevious = False
Next
End With
She is getting the same error on the following line:
pHeadFoot.LinkToPrevious = False
She says that Word on her work machine is on a network while her home
computer is not. I am not sure how that would throw an error when
trying to unlink a footer from the previous however.
This really has me stumped. Anyone have any further ideas? My thanks
in advance.
> Thanks for your reply. I have walked the person through what they were
> doing step by step on the phone and duplicated it on my computer. She
[quoted text clipped - 62 lines]
>
> - Show quoted text -
Jean-Guy Marcil - 26 Feb 2007 17:31 GMT
Berlie was telling us:
Berlie nous racontait que :
> The user is still seeing this erro on her work machine but not her
> home one. I have changed the code to the following:
[quoted text clipped - 22 lines]
> This really has me stumped. Anyone have any further ideas? My thanks
> in advance.
I tried your code as is, and it worked as expected. But my computer is not
on a corporate network...
Anyway, as you mentioned, I do not think that the network is the cause.
There must be something else going on.
Are you sure she tried it with the same document? Send her a test document
and ask her to test it "as is" (she may have to send it to her house by
email) at both location.
Or, I see that you are using the Selection object.... this may lead to
unpredictable results, try using the Range object instead:
Dim rgeSection As Range
Dim lngSecCount As Long
Dim pHeadFoot As Word.HeaderFooter
Set rgeSection = Selection.Range
With rgeSection
lngSecCount = .Sections(1).Index
.InsertBreak wdSectionBreakOddPage
End With
With ActiveDocument
.Range(Start:=.Sections(lngSecCount + 1).Range.Start, _
End:=.Content.End).PageSetup.VerticalAlignment = wdAlignVerticalTop
With .Sections(lngSecCount + 1)
For Each pHeadFoot In .Footers
pHeadFoot.LinkToPrevious = False
Next
End With
End With

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org