Download - Synkronizer Excel Compare

Transcript
Visual Basic for Applications (VBA)
7
Visual Basic for Applications (VBA)
7.1
Introduction
69
Synkronizer 10 has a new feature to load and save project files which for many 9.5 users means they
will no longer need to write their own code.
For those that do need to process recurring, standardized and or complex comparisons synkronizer's
functionality can be accessed
with Visual Basic for Applications (VBA).
YOU MUST HAVE A LICENSED DEVELOPER EDITION TO ACCESS SYNKRONIZER FUNCTIONS
To access the automation functionality of Synkronizer you must obtain a reference to the Application
Object of the ComAddin. Then you will need the Application.ActiveProject to start working.
We've provided 2 simple "wrapper" functions to simplify you work which we'll also use in following
examples.
1.
2.
3.
4.
5.
6.
7.
8.
Ensure Synkronizer 10 Developer Edition is installed.
Start Excel
Open a (new) workbook
Open the VB Editor (Keyboard Shortcut Alt-F11)
Select your workbook in the Project Explorer window
Select menu Tools/References, scroll to 'Synkronizer 10.0 Object Library', check it, and press ok.
Select menu Insert/Module
Copy the following code:
Function SynkApplication() As Synkronizer.Application
'Wrapper to retrieve the Application object
With Excel.Application.COMAddIns("Synkronizer.Connect")
'Ensure the addin is connected.
If Not .Connect Then .Connect = True
Set SynkApplication = .Object.Application
End With
'Display progress in Excel's status bar.
SynkApplication.DisplayStatus = True
End Function
Function SynkProject() As Synkronizer.Project
'Wrapper to retrieve the ActiveProject
If Not SynkApplication Is Nothing Then
Set SynkProject = SynkApplication.ActiveProject
End If
End Function
Note:
©2000-2014 XL Consulting GmbH, Switzerland