MSGRAPH (Steve)


J

John Svendsen

Hi Steve, thank you very much for your reply.

While running your suggested macro, it behaved just as I needed it to (it
did not bring the grayed-out text shown when one double-clicks the graph) -
it looks to me like the ".Include" after the Rows, Columns, Cells did the
trick.

I have looked, as far as I know how to, for info on this ".Include" but with
no luck - could you please point me to where I can find info on the
".Include" to see what it really does?

Again, thanks so much. JS

I need to find & repalce text in MSGprah, but only the entries that are
displayed (not grayed out) via VBA.

Can someone point me to where I can get GOOD information on MSGraph's (obs:
GRAPH.HLP is not it)

Ah. You noticed that too, eh? ;-)

Google on Automate + MSGraph or Graph and similar combinations to find
example
source code to study. That's one good approach.

Also, a LOT of what works in Excel will also work in MSGraph once you change
the object references (ie to the application and so on).

Poking at the object model's helpful too; you can add a reference to MSGraph
to
your VBA project then use the Object Viewer in the VBA IDE.

There may be better ways of going about what you want but a modification of
this might get you there:

Sub ShowEnabledData()

' Object variables
Dim oGraphChart As Object
Dim oDatasheet As Object
Dim oSh As Shape

' Misc variables
Dim lCol As Long
Dim lRow As Long
Dim LastCol As Long
Dim LastRow As Long
Dim x As Long

Dim MaxRows As Long
Dim MaxColumns As Long

Set oSh = ActiveWindow.Selection.ShapeRange(1)

' The higher the number, the slower this gets
' so set it as low as you practically can
MaxRows = 100
MaxColumns = 20

Set oGraphChart = oSh.OLEFormat.Object
Set oDatasheet = oGraphChart.Application.DataSheet
With oDatasheet

' Find LastRow
For x = 1 To MaxRows
If .Rows(x).Include Then
LastRow = x
End If
Next x
' Find LastCol
For x = 1 To MaxColumns
If .Columns(x).Include Then
LastCol = x
End If
Next x

For lRow = 1 To LastRow
If .Rows(lRow).Include Then
Debug.Print .Cells(lRow, 1)
End If
Next lRow

' Column headings
For lCol = 1 To LastCol
If .Columns(lCol).Include Then
Debug.Print .Cells(1, lCol)
End If
Next lCol

' Data
For lCol = 2 To LastCol
For lRow = 2 To LastRow
If .Rows(lRow).Include And .Columns(lCol).Include Then
Debug.Print .Cells(lRow, lCol)
End If
Next lRow
Next lCol

End With ' oDataSheet

End Sub
 
Ad

Advertisements

S

Steve Rindsberg

Hi Steve, thank you very much for your reply.

While running your suggested macro, it behaved just as I needed it to (it
did not bring the grayed-out text shown when one double-clicks the graph) -
it looks to me like the ".Include" after the Rows, Columns, Cells did the
trick.

I have looked, as far as I know how to, for info on this ".Include" but with
no luck - could you please point me to where I can find info on the
".Include" to see what it really does?

Here's what help has to say:

Include Property

True if the data in the specified row or column is included in the chart.
Read/write Boolean.

With myChart.Application.DataSheet
.Rows(2).Include = False
End With


To get there, I added a reference to MSGraph to my VBA project, used the Object
Browser to find Include and rightclick/chose Help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top