View Single Post
 
Old 12-08-2016, 10:31 PM
DevWord DevWord is offline Windows 10 Office 2010 64bit
Novice
 
Join Date: Dec 2016
Posts: 4
DevWord is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
That behaviour is unavoidable. The graph exists in an embedded Excel object and depends on data that are held in the worksheet behind it. The fact the data are sourced from Access is immaterial.
Hi Macropod, ok I understood, now samething I am doing with MS access just to see how this goes with ms access, I created a form and that with a button and code given by you as backend code for the button.

I did not do any code changes at all, well it generates the graph but for that generates series chart with series 3 as an addition item 1 and item 2 which have it VBA code.

Please find attached snapshot, also in ms access i have added Microsoft word 14.0 object library as add in reference.

I have MS office 2010/32 bit/ windows 10 running on my system.

below is code
Code:
Private Sub Command0_Click()

Dim iShp As InlineShape, wb As Object, ws As Object
 Set wdapp = CreateObject("Word.Application")
    wdapp.Visible = True
    Set wddoc = wdapp.Documents.Add
With wddoc 'xlLineMarkers,xlRadarFilled
  Set iShp = .InlineShapes.AddChart(Type:=xlRadarMarkers, Range:=.Range.Characters.Last)
  With iShp
    Set wb = .Chart.ChartData.Workbook
    Set ws = wb.Worksheets(1)
    With ws
      .Range("A2:A7").NumberFormat = "General"
      .Range("A2").Value = 1
      .Range("A3").Value = 2
      .Range("A4").Value = 3
      .Range("A5").Value = 4
      .Range("A6").Value = 5
      .Range("A7").Value = 6
      .Range("B1").Value = "Item 1"
      .Range("B2").Value = 100
      .Range("B3").Value = 120
      .Range("B4").Value = 140
      .Range("B5").Value = 160
      .Range("B6").Value = 180
      .Range("B7").Value = 200
      .Range("C1").Value = "Item 2"
      .Range("C2").Value = 210
      .Range("C3").Value = 190
      .Range("C4").Value = 170
      .Range("C5").Value = 150
      .Range("C6").Value = 130
      .Range("C7").Value = 110
    End With
    .Chart.Refresh
   wb.Application.Quit
  End With
End With



End Sub
Attached Images
File Type: png msaccessgraph.png (7.7 KB, 18 views)
Reply With Quote