Results 1 to 2 of 2
  1. #1
    DevAccess is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Jun 2016
    Posts
    2

    Post Access VBA and word graph

    Hello there,



    I would like to generate a radar chart in ms word document using VBA and data reference would be from ms access, here is the code which works well when I put the code in ms word macro and it generates the radar chart, however if I put same code in ms access code behind button it generates series chart. also in ms access I am adding reference of microsoft word 14.0 object library to make the reference of the word graph.
    I really dont understand why in word it works well but in ms access it generates series chart instead. also in when I generate the chart from acccess it adds series 3 adding to item 1 and item2, series 3 is not stated anywhere in ms access vba programming.
    Please advise. my intention is to generate radar chart in ms word document wherein data point would be from access, the code below is just illustrative. once this works I would bind the data from ms access itself.


    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

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,428
    Looks like the same question asked here?

    http://www.access-programmers.co.uk/...d.php?t=290942

    If so, please read this thread

    http://www.excelguru.ca/content.php?184

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 24
    Last Post: 07-28-2015, 10:50 AM
  2. Access to Word - Multiple Word Templates?
    By alpinegroove in forum Programming
    Replies: 11
    Last Post: 06-12-2012, 04:42 PM
  3. new graph for each item in access
    By Grahamvdh in forum Forms
    Replies: 7
    Last Post: 05-17-2012, 03:17 PM
  4. Replies: 6
    Last Post: 02-29-2012, 03:13 AM
  5. Replies: 3
    Last Post: 01-10-2011, 10:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums