FlexPro
HistoryBase
Engineering
Training
Downloads
FlexPro-Support
Wissen
Community
Über Uns
Referenzen
Jobs
Allgemeiner Kontakt
Händlerverzeichnis
FlexPro-Support
DE
EN
FR
Placeholder
Produkte und Lösungen
Support und Downloads
Unternehmen
Magazin
Kontakt
Sprache
MyWeisang

Account Einstellungen

Topic

Add a diagram to a document with VBA

Startseite ' Community ' Automation and VBA ' Add a diagram to a document with VBA

Anzeigen von 3-Stellen - 1 bis 3 (von insgesamt 3)
  • Autor
    Beiträge
  • #34994
    Nicolas Beaupré
    Teilnehmer

    Hi,
    I can read some properties of a page in VBA, such as the shape count, but I can’t add a 2DDiagramm to the page of the document.

    Here is my code : [code]Dim obj As DocObject
    Set obj = ActiveDatabase.RootFolder.Object(“diag”, fpObjectType2DDiagram)
    ‘obj is the DocObject

    With ActiveDatabase.RootFolder.Object(“doc”, fpObjectTypeDocument)
    .Pages(1).AddDocObject(fpObjectType2DDiagram, 0, 0, 10, 10, “diag”)
    .Pages(1).AddRectangle(20,20,30,30)
    End With[/code]
    The compiler talks about a syntax error, a ‘=’ would be required at the end of the lines.

    Any luck that someone can help me ? Thanks

    #34996
    Nicolas Beaupré
    Teilnehmer

    Hi,
    I can read some properties of a page in VBA, such as the shape count, but I can’t add a 2DDiagramm to the page of the document.

    Here is my code : [code]Dim obj As DocObject
    Set obj = ActiveDatabase.RootFolder.Object(“diag”, fpObjectType2DDiagram)
    ‘obj is the DocObject

    With ActiveDatabase.RootFolder.Object(“doc”, fpObjectTypeDocument)
    .Pages(1).AddDocObject(fpObjectType2DDiagram, 0, 0, 10, 10, “diag”)
    .Pages(1).AddRectangle(20,20,30,30)
    End With[/code]
    The compiler talks about a syntax error, a ‘=’ would be required at the end of the lines.

    Any luck that someone can help me ? Thanks

    #34995
    Bernhard Kantz
    Teilnehmer

    In VBA you have to remove the round brackets if you don’t use a assignment:
    [code]
    Dim oDiagram As Diagram2D
    ActiveDatabase.RootFolder.Add “Diagram”, fpObjectType2DDiagram
    Set oDiagram = ActiveDatabase.RootFolder.Add(“Diagram”, fpObjectType2DDiagram)
    [/code]
    The [b]Top[/b] value and the [b]Bottom[/B] value of the AddDocObject and the AddRectangle Property should be negative:
    [code]
    With ActiveDatabase.RootFolder.Object(“doc”, fpObjectTypeDocument)
    .Pages(1).AddDocObject fpObjectType2DDiagram, 0, 0, 100, -100, “diag”
    .Pages(1).AddRectangle 20, -20, 30, -30
    End With
    [/code]

    Support@weisang.com

Anzeigen von 3-Stellen - 1 bis 3 (von insgesamt 3)
  • Du musst angemeldet sein, um auf dieses Thema antworten zu können.