WasatchPhotonics / Wasatch.Excel

Excel demos showing how to access Wasatch Photonics spectrometers from VBA

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VBA Editor

Overview

Here is a simple spreadsheet showing how to access Wasatch Photonics spectrometers from inside Microsoft Excel via Wasatch.NET.

Click here to see just how simple the Visual Basic code can be:

Dependencies

The Excel demo requires that Wasatch.NET be installed, so if you haven't done so, download and run the appropriate installer here:

A few notes to ensure faultless installation:

  1. Note that You'll need to download the Wasatch.NET architecture (bitness) corresponding to your copy of Excel, which may be different than your version of Windows. (Many companies install 32-bit Office onto 64-bit Windows by default, and unless you're doing VBA programming you may never have reason to know the difference.) Use File -> Help to check which version of Excel you're using.

  1. Remember to configure the libusb drivers the first time you connect a Wasatch Photonics spectrometer to a computer:
  1. The Wasatch.NET installers strive to do everything for you...but one thing they don't currently do is register the COM assembly so it can be used by VB6 and VBA. For that, you need to lastly run the RegisterCOM.bat script as administrator, as described here:

That's it! Not such a heavy price to pay in order to perform live spectroscopy from a spreadsheet, is it :-)

Support

If you have any issues, please let us know and we'll do our best to resolve them expediently:

support@wasatchphotonics.com

Appendix: Excel VBA Quick Start

New to Visual Basic for Applications (VBA)? Here are some quick steps to get you going!

Enable VBA in Excel

If you haven't already done so, you need to manually enable the "Developer" ribbon in Microsoft Excel, which grants access to all the VBA goodies. (Instructions for Excel 2010):

  • Start by navigating to File -> Options...

  • select "Customize Ribbon", then check "Developer"...

  • adding the "Developer" tab to your ribbon, giving access to the Visual Basic editor...

  • ...providing a functional IDE in the middle of Excel!

Add Reference to WasatchNET to your spreadsheet

Now that you have the VBA IDE, we need to add a "reference" to Wasatch.NET so that you can refer to its namespace, classes and objects in your code.

  • From the VBA Editor, select Tools->References...

  • then "Browse" to C:\Windows\WasatchNET.tlb (note: not the .DLL next to it!)

  • You know you're finished when you see "[x] .NET application wrapper for Wasatch Photonics".

Get coding!

Using WasatchDemo.vb as an example, and refering to our API documentation as needed, start developing your Office-based spectroscopy application today!

Spreadsheet

About

Excel demos showing how to access Wasatch Photonics spectrometers from VBA

License:MIT License


Languages

Language:Visual Basic 100.0%