Microsoft
Software
Hardware
Network
Question : Copying graphs from Excel 2007 to word 2007 using VBA
Hi Folks
I have an Excel spreadsheet that creates a few graphs and I want to automate a process of dumping them into a word document then saving that word document.
I have the code that does this already and it works well, problem is that when I attempt to enter my second chart it replaces the previous chart I pasted in Any help would be great, Iv got my code below
' paste in the first chart
Set oPara3 = oDoc.Content.Paragraphs.Ad
d(oDoc.Boo
kmarks("\e
ndofdoc").
Range)
oPara3.Range.Text = "Chart Number 1"
oPara3.Format.SpaceAfter = 6
oPara3.Range.InsertParagra
phAfter
' copy the chart from Excel
Sheets("ChartNumber1").Sel
ect
ActiveChart.CopyPicture _
Appearance:=xlScreen, Size:=xlScreen, Format:=xlPicture
'paste into word document
oPara3.Range.Paste
'Paste in the second chart
Set oPara4 = oDoc.Content.Paragraphs.Ad
d(oDoc.Boo
kmarks("\e
ndofdoc").
Range)
oPara4.Range.Text = "2nd chart"
oPara4.Format.SpaceAfter = 6
oPara4.Range.InsertParagra
phAfter
Sheets("ChartNumber2").Sel
ect
ActiveChart.CopyPicture _
Appearance:=xlScreen, Size:=xlScreen, Format:=xlPicture
oPara4.Range.Paste
Answer : Copying graphs from Excel 2007 to word 2007 using VBA
soultion is to use
oPara4.Format.SpaceAfter = 6
oPara4.Range.InsertParagra
phAfter
after pasting the chart in.
Random Solutions
New Build (ASUS P7H55D-M EVO) not booting properly, can't install OS
IPSec VPN to Watchguard XTM 505 behind Draytek 2820
ATM clocking
Outlook/Exchange Issue with Emails not showing
SBS 2003 Premium. Windows 7 client and Microsoft Shared Fax - Do they work together?
Windows 2003 to 2008R2 cluster migration and enforced quota
restore from DB?
How can I get CFileDialog to not change the initial directory?
Access to toher User's Inboxes
tables with FK relationships at all