|
|
|
date: Sun, 01 Jun 2008 18:14:19 -0300,
group: microsoft.public.word.vba.beginners
back
Re: VBA Command to Refresh Excel Charts in Word 2007?
Hi Doug,
Thanks kindly for your assistance. These two charts are the only
items that are externally linked and I had previously tried your first
suggestion, but without success. This is new territory for me, so
bear with me as I stumble through this with you, but I originally cut
and paste these charts from Excel and chose the "Chart (linked to
Excel data)" option within the accompanying Paste options tag. The
document update method is set to manual and I can refresh the links
either through the Links dialog or by way of the Refresh Data command
within the Chart Tools - Data panel. So just to clarify this in my
own mind, does Word treat these charts as "fields", or do I need to do
something else to have them recognized as such or, alternatively, link
to them in some other fashion so as to have them properly initialized?
Thanks again for helping me complete this last piece of the puzzle.
Best regards,
Paul
On Mon, 2 Jun 2008 10:24:31 +1000, "Doug Robbins - Word MVP"
wrote:
>If it is OK to update all of the fields in the document, then use
>
> ActiveDocument.Fields.Update
>
>If you only want to update Links in the document, then use
>
> Dim alf as Field
> For each alf in ActiveDocument.Fields
> If alf.Type = wdFieldLink then
> alf.Update
> End if
> Next
date: Sun, 01 Jun 2008 23:43:18 -0300
author: Paul M. Eldridge
Re: VBA Command to Refresh Excel Charts in Word 2007?
What do you see if you press Alt+F9 in the document?
Is it something like
{ LINK Excel.Sheet.8 "Workbookname" "Sheetname![workbookname]Sheetname Chart
1" \a \p }
You said that you Cut the chart from Excel. Did you save the workbook after
doing that? If so, there would be no chart in the workbook for word to
update and when you try to update the Word document manually by selecting
the chart and pressing F9, you would get a message "Objects in this document
contain links to files that cannot be found. The linked information will
not be updated."
In those circumstances, in you use
ActiveDocument.Fields.Update
you do not get the message and nothing happens.
Otherwise, ActiveDocument.Fields.Update does cause a linked chart to be
updated for me.
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
"Paul M. Eldridge" wrote in message
news:33m644pmi8bs1vpl0lpfdmn9ongc1tb7ug@4ax.com...
> Hi Doug,
>
> Thanks kindly for your assistance. These two charts are the only
> items that are externally linked and I had previously tried your first
> suggestion, but without success. This is new territory for me, so
> bear with me as I stumble through this with you, but I originally cut
> and paste these charts from Excel and chose the "Chart (linked to
> Excel data)" option within the accompanying Paste options tag. The
> document update method is set to manual and I can refresh the links
> either through the Links dialog or by way of the Refresh Data command
> within the Chart Tools - Data panel. So just to clarify this in my
> own mind, does Word treat these charts as "fields", or do I need to do
> something else to have them recognized as such or, alternatively, link
> to them in some other fashion so as to have them properly initialized?
>
> Thanks again for helping me complete this last piece of the puzzle.
>
> Best regards,
> Paul
>
>
> On Mon, 2 Jun 2008 10:24:31 +1000, "Doug Robbins - Word MVP"
> wrote:
>
>>If it is OK to update all of the fields in the document, then use
>>
>> ActiveDocument.Fields.Update
>>
>>If you only want to update Links in the document, then use
>>
>> Dim alf as Field
>> For each alf in ActiveDocument.Fields
>> If alf.Type = wdFieldLink then
>> alf.Update
>> End if
>> Next
>
date: Mon, 2 Jun 2008 18:53:04 +1000
author: Doug Robbins - Word MVP
Re: VBA Command to Refresh Excel Charts in Word 2007?
Hi Doug,
Thanks again for your assistance; much appreciated. Some mixed
results to report. As per your previous note, I retried using the
ActiveDocument.Fields.Update command but it still doesn't work and
nothing happens when I press Alt+F9 (or at least nothing that is
visible onscreen). However, I can confirm the source spreadsheet is
re-saved under the original filename and within the original folder
after the data has been updated by the macro (hence the need to
refresh the document links) and I know the links are valid because I
can force a refresh through either the Links dialog or by way of the
Chart Tools - Data menu. One interesting twist, though... I selected
each chart and pressed F9 as you suggested below and both updated to
reflect the new numbers (go figure, eh?).
Any sense as to what I may have done wrong?
Best regards,
Paul
On Mon, 2 Jun 2008 18:53:04 +1000, "Doug Robbins - Word MVP"
wrote:
>What do you see if you press Alt+F9 in the document?
>
>Is it something like
>
>{ LINK Excel.Sheet.8 "Workbookname" "Sheetname![workbookname]Sheetname Chart
>1" \a \p }
>
>You said that you Cut the chart from Excel. Did you save the workbook after
>doing that? If so, there would be no chart in the workbook for word to
>update and when you try to update the Word document manually by selecting
>the chart and pressing F9, you would get a message "Objects in this document
>contain links to files that cannot be found. The linked information will
>not be updated."
>
>In those circumstances, in you use
>
>ActiveDocument.Fields.Update
>
>you do not get the message and nothing happens.
>
>Otherwise, ActiveDocument.Fields.Update does cause a linked chart to be
>updated for me.
date: Mon, 02 Jun 2008 09:53:17 -0300
author: Paul M. Eldridge
|
|