473,661 Members | 2,501 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Updating MSGraph datasheet in Word from VB

2 New Member
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.Offic e.Interop.Word. Shape
Dim oGraphChart As Microsoft.Offic e.Interop.Graph .Chart

word = CreateObject("W ord.Application ")
word.visible = True
doc = word.Documents. Open(My.Setting s.FormsPath & "\49.doc")

oShape = doc.Shapes(1).O LEFormat.Object
oGraphChart = oShape.OLEForma t.Object

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

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

oShape = doc.Shapes(1).O LEFormat.Object

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

oShape = doc.Shapes.AddO LEObject(Left:= 40, Top:=400, Width:=400, Height:=400, ClassType:="MSG raph.Chart", DisplayAsIcon:= False)

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

Any suggestions?
Nov 5 '07 #1
0 1602

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

Similar topics

2
2460
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 workstation it is normally run from has been upgraded to WinXP from WinNT 5.0. The issue is that the graphs will either display the data within the recordsource (a query), OR it will display the "temp" data in the chart's datasheet (from initial...
1
3355
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. However, the time is now to go one step further. I use a line-graph based on data from Crosstab-queries to show the sales for each salesman, each month. The problem is that the Boss liked it so much that he wants to add in
0
3229
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 changed. Thanks ***************************************** Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) 1 On Error GoTo Err_dF 5 Dim chr As Graph.Chart
0
1074
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 is a query joining these as follows: SELECT tblA.Code, tblA.Adata, tblB.Bdata FROM tblA INNER JOIN tblB ON tblA.Code = tblB.code; tblB.Code is the primary key in that table.
2
1619
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 Oracle database. Each morning a scheduled task opens the database, and the FormOpen event of a startup form imports the data from the Oracle linked tables
1
2927
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. --------------------------------------------------------------------------- Steve: I have followed your instructions to a "T". However, I continue to
5
3481
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 the cursor was on in the datasheet at the time I executed the macro. So, the questions are: 1) In the macro, how to I get my hands on the record key or record data of the record the cursor was on in the datasheet at the time I executed the...
0
2938
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 that the dll or ocx is not present or is an older version.
2
6413
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 net. It copies the data in each chart/datasheet and slide in powerpoint but I'm struggling with the bit to get the data into excel. Below it I've tried incoporating some code to paste into excel but it does not seem to work. Hope someone can...
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8855
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8758
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8545
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7364
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5653
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4346
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1986
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1743
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.