Create report using vba

Started by Rablam, July 06, 2011, 08:32:00 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Rablam

Hi!

I am trying to manipulate reports in visio trough vba.
With the code below I can reopen a report that already exists.

Visio.Application.Addons("VisRpt").Run ("/rptDefName=Report_1/rptOutput=EXCEL_SHAPE")

But how to manage to create a new report, or to set what shapes are in the report, or even to change the columns and data I want to show in the report.

Did anyone already succeed to do this kind of thing with reports? Hope I can get some help.

Rablam.

aledlund

I think John Marshall had some blog posts on reports on his site (visio.mvps.org).
al

Rablam

thanks  aledlund, but I can't find anything about report on that website visio.mvps.org.

aledlund

sorry about that, it was his other site where he keeps the blogs

http://msmvps.com/blogs/visio/default.aspx?PageIndex=2

al


the visio report format is in xml... this from John




Visio's other file format - Report Definition files *.VRD
It has been a long standing fact that though there were several Visio file types; stencils, drawing, templates and workspaces, there was a only one Visio file format. Several versions ago, a new file format crept into the Visio file format family. Visio added a reporting facility that used a seperate file to store information about how to create the report.

About the same time, Visio gave the Visio user the oppurtunity to save Visio drawings in XML format. So, the information in the Visio Report Definition (VRD) files is also stored in XML format. For Visio 2003, the third version of the VRD, schemas were created.  (schemas-microsoft-com:office:visio:reportdefinition).

The VRD file is divided into several sections. The first section sets basic information for the report, the title, the description.

The second section, a collection of <VisioRptDefField>s, describes the fields to be used, the column headers and the order.

The third section, a collection of <VisioRptDefFilter>s, describes the filters that would apply to select the information for the report.

The fourth section, <VisioRptDefGroup>, describes how the records are grouped.

The fifth section, a collection of <VisioRptDefSort>s, describe how the information is sorted.

For Visio 2007, there are no new or deleted reports and the only changes are very, very minor corrections to the reports' description.

So what is the point of knowing this? I have yet to see a request in the Visio newsgroups for automating report creation, but creating or modifying XML will be far easier than trying to control the wizard by Sendkey.

John... Visio MVP


Rablam

thanks a lot al.

This will surely help me, I ll see what I can do with it.
Rablam.