Andreas Hermle
asked on
Change font size of axis labels for all embedded excel charts
Dear Experts:
I got dozens of embedded excel charts in a word document.
I'd like to change the font size of the diagram title, axes and axis labels in one go for all embedded charts.
Can this be done directly from Word for Windows? I attached a sample file for your convenience.
Help is much appreciated. Thank you very much in advance.
Regards, Andreas
manipulate-embedded-excel-charts.docx
I got dozens of embedded excel charts in a word document.
I'd like to change the font size of the diagram title, axes and axis labels in one go for all embedded charts.
Can this be done directly from Word for Windows? I attached a sample file for your convenience.
Help is much appreciated. Thank you very much in advance.
Regards, Andreas
manipulate-embedded-excel-charts.docx
Are these LINKed or EMBEDded objects? In your Word document, press Alt+F9 and look at the field codes. Are they LINK codes or EMBED codes?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dear lwebber,
thank you very much for your swift and professional response. I tried your code out on a word document with 2 embedded excel files.
I added the following code line to your code:
thisChartObject.Chart.Axes (xlCategor y).TickLab els.Font.S ize = 8 'Put your chart formatting commands here
I am afraid to tell you that this code somehow does achieve the desired results. It opens the chart in Excel but otherwise does nothing. The embedded Excel charts in the Word Document get strangely enlarged. I got no idea why this is so.
I have attached my sample file for your convenience. The word document contains your code with my little code snippet added.
Again, thank you very much in advance for your kind help.
Regards, Andreas Embedded-Excel-Charts-Sample-Fil.doc
thank you very much for your swift and professional response. I tried your code out on a word document with 2 embedded excel files.
I added the following code line to your code:
thisChartObject.Chart.Axes
I am afraid to tell you that this code somehow does achieve the desired results. It opens the chart in Excel but otherwise does nothing. The embedded Excel charts in the Word Document get strangely enlarged. I got no idea why this is so.
I have attached my sample file for your convenience. The word document contains your code with my little code snippet added.
Again, thank you very much in advance for your kind help.
Regards, Andreas Embedded-Excel-Charts-Sample-Fil.doc
Rather than you try to explain in words what chart formatting you want, try this. In Excel, open one of the charts. Record a macro while you reformat the chart. Turn off the recorder, then examine the Excel macro. Transfer those commands to the Word macro.
The important Word variables that "hook" you into Excel are:
excelApp == equivalent to Excel's Application object
thisWorksheet == equiv. to Excel's Application.ActiveSheet object.
In your recorded macro, you may see the Selection object recorded. Selection is a member of the Application object (not the worksheet). Since the Word macro doesn't start with anything selected, you must get an explicit reference to the thing you want to reformat. That's the purpose of the Set thisChartObject = thisWorkSheet.ChartObjects (1) command.
If your recorded macro includes something like this:
ActiveSheet.ChartObjects(" Chart 1").Activate
then in the Word macro, add
thisChartObject.Activate
Then where your Excel macro refers to ActiveChart, your Word macro would use excelApp.ActiveChart. You should then be able to copy and paste the commands from the Excel macro into the Word macro -- just be sure to prefix ActiveChart with excelApp.ActiveChart.
The important Word variables that "hook" you into Excel are:
excelApp == equivalent to Excel's Application object
thisWorksheet == equiv. to Excel's Application.ActiveSheet object.
In your recorded macro, you may see the Selection object recorded. Selection is a member of the Application object (not the worksheet). Since the Word macro doesn't start with anything selected, you must get an explicit reference to the thing you want to reformat. That's the purpose of the Set thisChartObject = thisWorkSheet.ChartObjects
If your recorded macro includes something like this:
ActiveSheet.ChartObjects("
then in the Word macro, add
thisChartObject.Activate
Then where your Excel macro refers to ActiveChart, your Word macro would use excelApp.ActiveChart. You should then be able to copy and paste the commands from the Excel macro into the Word macro -- just be sure to prefix ActiveChart with excelApp.ActiveChart.
ASKER
Dear lwebber:
thank you very much for your detailed explanations. I will give a try and let you know.
Thank you again for your professional support.
Regards, Andreas
thank you very much for your detailed explanations. I will give a try and let you know.
Thank you again for your professional support.
Regards, Andreas
ASKER
Dear lwebber,
great it worked just fine. Thank you very much for your great and professional help.
Regards, Andreas
great it worked just fine. Thank you very much for your great and professional help.
Regards, Andreas