WinPTE.com

 

WinPTE Add-In for VBA® Version 0.80.429

Launch External Tools from VBA IDE and Edit VBA code in WinPTE

The Add-In provides comfortable switching from VBA code window to WinPTE and vice-versa. It also provides:

  1. Save the code window in a disk file.
  2. Launch external tools and pass the code window file name, cursor line and column positions.
  3. Assign shortcut keys to external tools.
  4. Automatic saving or exporting of all project modules to disk when VBA project is saved.
  5. Detection of modification to the disk file for the code window and optional reloading of code window from disk.
  6. Provide difference between current code window contents and saved disk file contents If an external difference viewer is configured. Recommended difference view/merge tool is Beyond Compare 2 from www.scootersoftware.com. The AddIn will automatically configure the command line arguments for BC2 when it is added as an external command.
  7. Enables code window scrolling via mouse wheel.

The AddIn will work in any VBA enabled application. Multiple VBA environments can be running simultaneously and all will share the same configuration settings.

AddIn Toolbar

Configuring external tools will add buttons after the "Reload from Disk" (button 5).

  1. Properties. Use this to configure the AddIn.
  2. Edit in WinPTE. Will edit the current code window or the code of the currently selected module in the VBA project tree in WinPTE. Cursor in WinPTE will be in the same location as in VBA..
  3. Save file to disk. Will save the current code window or the code of the currently selected module in the VBA project tree.
  4. Delete disk file for the code window or the code window of the currently selected module in the VBA project tree. Does not affect the project item. Only the addin created disk file is removed. If the "Delete files on Close" option is not selected then the file is not deleted. Only the link between the code window and the file is broken so that file modifications will no longer affect the code window.
  5. Reload code window from disk file.

To Synchronize cursor location from WinPTE back to VBA code window press the "Sync Addins" button on the WinPTE toolbar..

WinPTE Sync AddIns Button

Pressing the "Sync Addins" buttons will save all modified files in WinPTE, which by itself is enough to allow AddIns to detect and reload the code window contents from the disk files. Also passes cursor line and column information to the AddIns.

The VBA IDE which contains the currently active file in WinPTE will be brought to the foreground. The "Edit in WinPTE" and "Sync AddIns" allow switching from VBA to WinPTE and back as needed.

Configuration

 

Options

Diff File Path Defines the file path to use when saving current code window contents for difference viewer external tool
File Path Defines the file path to use when saving the code window to disk for external tools and WinPTE editing
Update File on Project Save If checked, saving the project (Ctrl+S) will also save all code windows that have a disk file.
Detect external file modifications If checked will detect when a disk file for a code window is modified by an external program. Will prompt to replace code window with disk file contents.
Automatically update externally modified files. If checked externally modified files will be applied to their respective code window without prompting, unless the code window has been modified since the file was saved.
Delete disk files when closing. If checked will clean-up the created disk files and directories used for external tools. Does not apply to project shadow files which are not deleted.
WinPTE synchronizes active file only. If checked then Sync WinPTE addins to file will synchronize cursor position for the active file in WinPTE. If unchecked will synchronize all files that are in the current VBA session and which are open in WinPTE.
Enable MouseWheel for code panes. Allows mouse wheel scrolling to be available in the VBA code windows.

 

External Tools

External tools will appear as buttons after the "Reload from Disk" (button 5) of the WinPTE AddIn toolbar.

Command File path of the file to run.
Arguments Command line arguments to pass to the tool.
Initial Directory Startup directory for the tool.
Shortcut Type the key combination you want to use for launching this tool. ESC to clear. Assigning a shortcut to a tool clears the same shortcut combination from any other tool. Keys used for text entry or basic cursor navigation are not assignable. Shortcuts are only enabled when VBA IDE does not have an active popup. Any assigned shortcuts will override VBA assigned shortcuts..
Diff Viewer If checked will have Diff menu items which refer to the Diff File Path which contains current code window contents. File items refer to the saved disk file. Also, the first Diff Viewer in the list will be used by Disk File Modifications dialogs to display difference between disk file and code window contents.
Save UNICODE If checked the saved file will be UNICODE encoded. Otherwise it is ANSI. Remember that all tools refer to the save file for the code window. The file will contain encoding of the last launched tool.
Save Project Not Implemented. Save project before launching tool.

Shadow Project Modules on Project Save If checked then all projects marked with will have their modules saved to disk when the project is saved. These saved files are not deleted when the Add-In is closed.
Shadow Path Defines the File path to use for saving or exporting the module "shadow files"
Export Shadow Files If checked, then modules will be Exported, if not then only the code window will be saved. Exporting will create a complete configuration snapshot of the project files.
Save UNICODE Only available if Export is not checked and selects the file encoding to be UNICODE.
Update File on Project Save If checked, saving the project (Ctrl+S) will also save all code windows that have an external tools disk file. This means only files against which an external tool was already launched. (file path is defined by the File Path from the Options page).
Create files for all modules on save If checked then projects not marked with will have code for all modules saved to the external tools disk file defined by the File Path from the Options page.
Projects List of projects that are shadowed and/or automatically saved to external tools files. Projects open in the current VBA session will be marked by default. Therefore no shadowing or tools file creation will be performed..

 

Path Definition Macros

These are replaced by actual values from the module, project or the external tools file name.

For example purposes the following values are used:

Property
Value
Project File
C:\Program Files\WinPTE\Custom.ptv
Project Name
MyCustom
Class Name
Helper
Temp
C:\Temp\
External Tool File

C:\Program Files\WinPTE\Custom\Temp\Helper.cls

Diff File

C:\Temp\Helper.cls

 

Macro String Value Comments
$(ProjFileName)
Custom Not available if project is a new unsaved document
$(ProjFilePath)
C:\Program Files\WinPTE\Custom Not available if project is a new unsaved document
$(ProjFileDir)
C:\Program Files\WinPTE Not available if project is a new unsaved document
$(ProjFileExt)
.ptv Not available if project is a new unsaved document
$(ProjName) MyCustom  
$(ModuleName) Helper.cls (extension is automatically appended Not available if no code window is open and no module is selected in the project tree.
$(FileName) Helper.cls  
$(FilePath)
C:\Program Files\WinPTE\Custom\Temp\Helper.cls  
$(FileDir) C:\Program Files\WinPTE\Custom\Temp  
$(Line)
Current cursor line in the code module. If code module is not open then 1.  
$(Column) Current cursor position in the code module. If code module is not open then 1.  
$(TempDir) C:\Temp Actual value taken from TEMP or TMP environment variable.
$(DiffName)
Helper.cls Only available for external tools marked as Diff Viewer
$(DiffPath)
C:\Temp\Helper.cls Only available for external tools marked as Diff Viewer
$(DiffDir) C:\Temp Only available for external tools marked as Diff Viewer

 

Path Definition Strings

Default values for path definitions are as follows::

Property
Value
Diff File Path
$(TempDir)\$(ModuleName)
File Path
$(ProjFilePath)\Temp\$(ModuleName)
Shadow Path
$(ProjFilePath)\$(ModuleName)

 

File Modification Message Boxes

File Modification detection is done when VBA IDE regains focus. This was done to prevent pop-ups while working in the IDE. To trigger detection switch to another application window and then back to VBA IDE.

The file is considered modified if its date/time stamp is changed and its MD5 signature is different. Therefore changing the modification time of a file will not trigger a modification detection message box.

File Modification Detected

Yes Will replace the code window with the file contents
No Skip this modification. You will not be prompted again until the file modification date/time changes again.
Show Diff Only available if there is at least one external tool configured as a Diff Viewer. Will launch the difference viewer to show difference between current code pane contents and the disk file. If the difference viewer is capable of merging. Then simply merge desired changes to the disk file and then select Yes to load the merged contents.

 

File Modification Conflict

This occurs if the code is edited in VBA and also changes on disk. Automatic update in this case could potentially result in loss of work. Changes are detected based on MD5 signature of code window contents.

Yes Will replace the code window with the file contents
No Skip this modification. You will not be prompted again until the file modification date/time changes again.
Show Diff Only available if there is at least one external tool configured as a Diff Viewer. Will launch the difference viewer to show difference between current code pane contents and the disk file. If the difference viewer is capable of merging. Then simply merge desired changes to the disk file and then select Yes to load the merged contents.

 

Project Needs Saving

The AddIn uses the VBA project file name for distinguishing between projects and generating the file name. This property is not available in new documents until the document is saved. Therefore selecting any operation which requires the project file name will result in the following message box, simply click OK, then save the project and redo the operation.

OK Closes dialog. Operation is not performed. Save project and redo operation.

 

About Page

Gives the version number and web links.

Site Map | Privacy Policy | Contact Us | ©2004 Winpte.com