International  | Contact | How to find PTVImprint | GTC

New add-ins for smooth Excel & VISUM workflow

Experienced users of Excel and VISUM often combine the strengths of the two products, by automating VISUM from Excel VBA or even performing matrix manipulations in Excel instead of within VISUM. These users will value two new add-ins which specifically support this combination. Both features were requested only recently by your fellow users at user group meetings. Thanks to the flexible add-in architecture we could include them in a service pack instead of making you wait until the next major release.

Execute VBA scripts within Calculate – Procedures

Sometimes you would like to run a piece of VBA code in the middle of an operation sequence under Calculate – Procedures. Reasons can include anything from manipulating the network to reporting intermediate results. Insert the new Run VBA add-in into your operation sequence like this:

 

In the parameters of the operation you specify the file path of an Excel Workbook which contains your VBA code, and the name of the VBA subroutine to be executed. Your workbook MyExcelScripts.xlsx would, for example, contain the following code for saving assigned link volumes to the spreadsheet.

 

Sub MyLoggingFunction(Visum)

Set s = ThisWorkbook.ActiveSheet

N = Visum.Net.Links.Count

s.Range(s.Cells(1, 1), s.Cells(N, 2)) = Visum.Net.Links.GetMultiAttValues

("VOLVEHPRT(AP)")ThisWorkbook.Save

End Sub

This could be the basis of your customized reporting after a highway assignment where you automatically compute and chart aggregate statistics in Excel.

Load matrices from Excel

Let’s say that you processed the contents of an OD matrix in Excel and now want to load it into VISUM for assignment. The easiest way is through the new Load Matrix from Excel add-in. Execute the add-in from the Scripts menu:

 

Then fill in the dialog:

 

 

Specify the file path to your Excel workbook, the worksheet name (if not the first one), the top left cell of the range occupied by the matrix contents, and the target matrix object in VISUM. Then click OK. VISUM will open the workbook in the background and transfer the matrix data. No manual reformatting of CSV files is required!

© PTV AG 2012
Any technical questions or comments concerning our website?
Simply send an e-mail to our webmaster