Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jan Jan is offline
external usenet poster
 
Posts: 159
Default Unlink graphics in VBA

Dear all,

Does anybody know how I can break links (coming from excel graphics)in word
using VBA in excel?

I have a macro which opens a word document, then removes the links to word
(except the graphs links) and save the word document.

the following solutions did not help me:
ActiveDocument.Fields.Unlink

Sub RemoveLinks()
Dim aField As Object

For Each aField In ActiveDocument.Fields
aField.LinkFormat.BreakLink
Next aField

End Sub


thanks,
Jan

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Unlink graphics in VBA

If you want to break the links before loading the chart
into word, you can use a macro similar to the following:

Sub BreakChartLinks()
For Each X In ActiveChart.SeriesCollection
X.Values = X.Values
X.XValues = X.XValues
X.Name = X.Name
Next X
End Sub

Another option is to save an embedded chart as a picture
and then bring the picture into Word. In Excel, hit the
Shift - Edit keys (both at the same time) and then go to
Copy Picture. You can paste it into the Word Document.

Or, a better solution to export the chart as a graphic
would be to use John Walkenbach's J-Walk Chart Tools add-
in. The add-in can be found at http://www.j-walk.com/ss.


-----Original Message-----
Dear all,

Does anybody know how I can break links (coming from

excel graphics)in word
using VBA in excel?

I have a macro which opens a word document, then removes

the links to word
(except the graphs links) and save the word document.

the following solutions did not help me:
ActiveDocument.Fields.Unlink

Sub RemoveLinks()
Dim aField As Object

For Each aField In ActiveDocument.Fields
aField.LinkFormat.BreakLink
Next aField

End Sub


thanks,
Jan

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
Jan Jan is offline
external usenet poster
 
Posts: 159
Default Unlink graphics in VBA

John,

See below my macro for opening a word document, read and save it.

You see the code 'ActiveDocument.Fields.Unlink' for unlinking the excel
cells. Now I have to this also for my excelcharts in word who have a link to
excel. The code you proposed did not work.

Do you have another idea?
Thanks,
Jan


Sub OpenAndReadWordDoc(i As String)
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim tString As String, tRange As Word.Range
Dim p As Long, r As Long
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Open("D:\Survey04\Chapter 6 with links.doc")
ActiveDocument.Fields.Unlink

With wrdDoc
.SaveAs ("D:\Survey04\Chapter 6 \" & i & ".doc")
.Close ' close the document
End With

wrdApp.Quit ' close the Word application
Set wrdDoc = Nothing
Set wrdApp = Nothing
ActiveWorkbook.Saved = True
End Sub


"John Mansfield" wrote:

If you want to break the links before loading the chart
into word, you can use a macro similar to the following:

Sub BreakChartLinks()
For Each X In ActiveChart.SeriesCollection
X.Values = X.Values
X.XValues = X.XValues
X.Name = X.Name
Next X
End Sub

Another option is to save an embedded chart as a picture
and then bring the picture into Word. In Excel, hit the
Shift - Edit keys (both at the same time) and then go to
Copy Picture. You can paste it into the Word Document.

Or, a better solution to export the chart as a graphic
would be to use John Walkenbach's J-Walk Chart Tools add-
in. The add-in can be found at http://www.j-walk.com/ss.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pages in a worksheet linked, how to unlink?? Meenie Excel Worksheet Functions 2 April 22nd 23 10:10 AM
Want to unlink calculations Otto Moehrbach[_2_] Excel Worksheet Functions 0 July 9th 08 09:12 PM
Want to unlink calculations electricbluelady Excel Worksheet Functions 3 June 26th 08 01:38 PM
Unlink a file ?? Kane New Users to Excel 3 February 5th 06 08:01 PM
How do I unlink cells in different worksheets when there are no a. kbigs Excel Worksheet Functions 1 December 1st 04 02:22 AM


All times are GMT +1. The time now is 10:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"