![]() |
#5
|
|||
|
|||
![]() Quote:
That's true, though i didn't run into a compile error when executing my code ![]() Code:
Function WorkbookIsOpen(filePath As String, xlApp As Excel.Application) As Boolean Code:
If Not WorkbookIsOpen(filePath, xlApp) Then ... Quote:
I tried this, but then in this block it somehow jumps to the "else" condition and the message box is displayed Code:
If Not chartObj Is Nothing Then ' Copy the chart as an image 'chartObj.CopyPicture Appearance:=1, Format:=2 ' xlScreen, xlPicture chartObj.ChartArea.Copy 'chartObj.Copy ' Paste into Word if bookmark exists If ActiveDocument.Bookmarks.Exists(wordBookmark) Then Set bmRange = ActiveDocument.Bookmarks(wordBookmark).Range bmRange.Paste ActiveDocument.Bookmarks.Add wordBookmark, bmRange ' Re-add the bookmark after paste End If Else MsgBox "Chart '" & rangeOrChart & "' not found in sheet '" & sheetName & "'", vbExclamation End If Code:
Dim chartObj As Excel.Chart Code:
Dim chartObj As Excel.chart Quote:
![]() (I now also added "Option Explicit" at the beginning of my code to avoid getting into troubles concerning variable declaration) |
Tags |
charts, copy, update |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
soroush.kalantari | Word VBA | 3 | 06-27-2021 06:15 PM |
Problem With Updating Linked Excel Tables in Word 2013 | maverick1714 | Word | 6 | 09-30-2014 12:30 AM |
![]() |
awaywithpixie | Word | 1 | 09-10-2013 10:35 AM |
Updating lists of figures/Tables in a protected document | IHARKIS | Word | 0 | 03-02-2011 04:39 AM |
Auto-updating basic math functions & cross-referencing tables | FranklinBluth | Word Tables | 13 | 11-19-2009 10:26 AM |