Domanda

On access in VBA, I use the Graph.Chart object to rezise all the text so it fits well and change the titles to match the data displayed.

I tested severals computer and everything works well, but in a presentation room, its not working.

I get a Error 13, Type mismatch

Dim oGraph As Graph.Chart

'Error after oGraph set. (Type mismatch)
Set oGraph = Me.Graphique0.Object

Dim chSeries As Series
For Each chSeries In oGraph.SeriesCollection
    chSeries.DataLabels.Orientation = 45
    With chSeries.DataLabels.Font
        .Name = "Calibri"
        .FontStyle = "Normal"
        .Size = 10
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ColorIndex = vbBlack
        .Background = xlAutomatic
    End With
Next

I had a problem with reference with ADO, but the reference was not set on the references in access

DAO: C:\Program Files\Common Files\Microsoft Shared\OFFICE14\ACEDAO.DLL
Graph: C:\Program Files\Microsoft Office\Office14\GRAPH.EXE

Graph is the one that doesnt work i think, but there is NO difference in version between the two computer.

I tried to decompile, compile and compact the database, no luck. Tried deleting the reference, no luck. No references shows "MISSING"

È stato utile?

Soluzione

Use late-binding to allow the code to run:

Dim oGraph As Object
Dim chSeries As Object

It may be that the Graph is not correctly registered on the computer. You could register it manually. I would create a Restore Point before doing this, just in case (possibly even back up the registry, but this is perhaps over cautious).

  • Click the Start button, Run
  • "C:\Program Files\Microsoft Office\Office14\GRAPH.EXE" /REGSERVER

Re-installing Access and making sure it is up-to-date with all Windows Updates is another possibility.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top