473,396 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Updating MSGraph datasheet in Word from VB

I have a word document that contains a Graph (MSGraph). I am trying to update the Chart's datasheet with new values, but I cannot seem to get the correct reference for the chart object. What I am trying is:

---------------------------------------

Dim oShape As Microsoft.Office.Interop.Word.Shape
Dim oGraphChart As Microsoft.Office.Interop.Graph.Chart

word = CreateObject("Word.Application")
word.visible = True
doc = word.Documents.Open(My.Settings.FormsPath & "\49.doc")

oShape = doc.Shapes(1).OLEFormat.Object
oGraphChart = oShape.OLEFormat.Object

--------------------------------------------

I am gettig a NullReferenceException(Object reference not set to an instance of an object) at:

oShape = doc.Shapes(1).OLEFormat.Object

however, if I do not have an exisiting chart, and simply add a new one using:

oShape = doc.Shapes.AddOLEObject(Left:=40, Top:=400, Width:=400, Height:=400, ClassType:="MSGraph.Chart", DisplayAsIcon:=False)

then this provides a reference to the chart object that I can use.

Any suggestions?
Nov 5 '07 #1
0 1580

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Anthony Cuttitta Jr. | last post by:
We have an application that outputs several different graphs from data downloaded from our AS400. The application has worked without (this) issue for several months now, but just recently, the...
1
by: Andre Kristoffersen | last post by:
Hi! I have found the MSGraph object very easy to use in Access if you use it in a straightforward manner. Just by changing the object rowsource ( I use sql), the graph changes accordingly. ...
0
by: Dave | last post by:
Can someone tell me how to change a single legend entry from a Stacked Bar Chart to a Line Chart. All the rest need to stay at a Stacked Bar Chart. Line 50 on the below code is what needs to be...
0
by: Dave Stone | last post by:
Can anyone explain what is happening here? 2 tables tblA and tblB, each with a code column and a full-text column (e.g. C001, "Joe Bloggs"). tblA contains a small subset of the rows in tblB. There...
2
by: phil03 | last post by:
Hi, I'm looking for some thoughts/guidance about the following scenario. A bit background first.... I have an Access database (BE) which has numerous linked tables connected to our company...
1
by: George Kandaz | last post by:
Steve, I posted a question to your last post almost a week ago, but never heard from you again. Please read my last message, as follows. Thanks. ...
5
by: Bill | last post by:
This database has no forms. I am viewing an Access table in datasheet view. I'd like to execute a macro to execute a function (using "runcode"). In the function, I'll reading data from the record...
0
by: G Gerard | last post by:
Hello I have a graph in a report that is has the following properties: OLE Class - Microsoft Graph 2000 Chart Class - MSGraph.Chart.8 On some computers this graph does not work. I suspect...
2
by: LucasLondon | last post by:
Hi, I'm trying to use VBA to extract underlying data from charts in powerpoint to excel, i.e from the underlying powerpoint datasheet that feeds the chart. I've found the macro below on the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.