I am trying to find away to automatically break linked
data from excel with out having to use the "edit" menu,
and after much searching have drawn a blank.

If anyone has any ideas if it's possible, i'd be very
appreciative

Re: Breaking Links in Word using VBA by Jean-Guy

Jean-Guy
Wed Feb 18 13:10:59 CST 2004

Hi Thom,

Look up the <Unlink> method
(
if your Excel object is inline:
Selection.Fields(1).Unlink
)
or
the <BreakLink> method
(
if your Excel object is wrapped:
ActiveDocument.Shapes(1).LinkFormat.BreakLink
)
.

There are good examples in the VBE help.

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


"Thom" <thom.moon@baring-asset.com> a écrit dans le message de news:
11e8801c3f63b$56a98740$a301280a@phx.gbl...
> I am trying to find away to automatically break linked
> data from excel with out having to use the "edit" menu,
> and after much searching have drawn a blank.
>
> If anyone has any ideas if it's possible, i'd be very
> appreciative



Re: Breaking Links in Word using VBA by anonymous

anonymous
Thu Feb 19 05:06:26 CST 2004

This is absolutely brilliant, and will save an enormous=20
amount of time.

Just one question.

I can break all the links in the document and the frames,=20
but can't seem to be able to break the links in the Header=20
and any text boxes. Text boxes aren't such a problem as I=20
can, if necessary change them to frames, but the Headers=20
would be useful.

Any ideas?

Many thanks

Thom
>-----Original Message-----
>Hi Thom,
>
>Look up the <Unlink> method
>(
>if your Excel object is inline:
> Selection.Fields(1).Unlink
>)
>or
>the <BreakLink> method
>(
>if your Excel object is wrapped:
> ActiveDocument.Shapes(1).LinkFormat.BreakLink
>)
>..
>
>There are good examples in the VBE help.
>
>--
>Cheers!
>_______________________________________
>Jean-Guy Marcil - Word MVP
>jmarcilREMOVE@CAPSsympatico.caTHISTOO
>Word MVP site: http://www.word.mvps.org
>
>
>"Thom" <thom.moon@baring-asset.com> a =E9crit dans le=20
message de news:
>11e8801c3f63b$56a98740$a301280a@phx.gbl...
>> I am trying to find away to automatically break linked
>> data from excel with out having to use the "edit" menu,
>> and after much searching have drawn a blank.
>>
>> If anyone has any ideas if it's possible, i'd be very
>> appreciative
>
>
>.
>

Re: Breaking Links in Word using VBA by Jean-Guy

Jean-Guy
Thu Feb 19 10:20:15 CST 2004

Hi Thom,

You have to cycle through all the StoryRanges.
Something like:

'_______________________________________
Sub test()
Dim myStoryRge As Range
Dim myCount As Long

For Each myStoryRge In ActiveDocument.StoryRanges
myCount = myCount + 1
While Not (myStoryRge.NextStoryRange Is Nothing)
Set myStoryRge = myStoryRge.NextStoryRange
myCount = myCount + 1
Wend
Next myStoryRge

MsgBox "There are " & myCount & " Story Ranges in this document."

End Sub
'_______________________________________

See the VBE Help, there are some more complete examples.
Look up also StoryType.

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


<anonymous@discussions.microsoft.com> a écrit dans le message de news:
1238c01c3f6d8$6ad971b0$a101280a@phx.gbl...
This is absolutely brilliant, and will save an enormous
amount of time.

Just one question.

I can break all the links in the document and the frames,
but can't seem to be able to break the links in the Header
and any text boxes. Text boxes aren't such a problem as I
can, if necessary change them to frames, but the Headers
would be useful.

Any ideas?

Many thanks

Thom
>-----Original Message-----
>Hi Thom,
>
>Look up the <Unlink> method
>(
>if your Excel object is inline:
> Selection.Fields(1).Unlink
>)
>or
>the <BreakLink> method
>(
>if your Excel object is wrapped:
> ActiveDocument.Shapes(1).LinkFormat.BreakLink
>)
>..
>
>There are good examples in the VBE help.
>
>--
>Cheers!
>_______________________________________
>Jean-Guy Marcil - Word MVP
>jmarcilREMOVE@CAPSsympatico.caTHISTOO
>Word MVP site: http://www.word.mvps.org
>
>
>"Thom" <thom.moon@baring-asset.com> a écrit dans le
message de news:
>11e8801c3f63b$56a98740$a301280a@phx.gbl...
>> I am trying to find away to automatically break linked
>> data from excel with out having to use the "edit" menu,
>> and after much searching have drawn a blank.
>>
>> If anyone has any ideas if it's possible, i'd be very
>> appreciative
>
>
>.
>



Re: Breaking Links in Word using VBA by macropod

macropod
Fri Feb 20 14:48:25 CST 2004

Hi Thom,

Try:

Sub UnlinkFields()
Dim oSection As Section
Dim shp as Shape
Dim oHeadFoot As HeaderFooter
ActiveDocument.Fields.Unlink
For Each oSection In ActiveDocument.Sections
For Each oHeadFoot In oSection.Footers
If Not oHeadFoot.LinkToPrevious Then oHeadFoot.Range.Fields.Unlink
Next
For Each oHeadFoot In oSection.Headers
If Not oHeadFoot.LinkToPrevious Then oHeadFoot.Range.Fields.Unlink
Next
Next oSection
For Each shp In doc.Shapes
With shp.TextFrame
If .HasText Then
.TextRange.Fields.Unlink
End If
End With
Next
End Sub

This will go through the body of the document, headers, footers and any
shapes (eg text boxes) that contain text, in that order.

Cheers


"Thom" <thom.moon@baring-asset.com> wrote in message
news:11e8801c3f63b$56a98740$a301280a@phx.gbl...
> I am trying to find away to automatically break linked
> data from excel with out having to use the "edit" menu,
> and after much searching have drawn a blank.
>
> If anyone has any ideas if it's possible, i'd be very
> appreciative


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.580 / Virus Database: 367 - Release Date: 6/02/2004