4
March 25th, 2004 John T. Anderson - AFE board tes t VBA Visual Basic For Applications (VBA) - AFE Board-level Test Package What to Expect Today lots of graph objects – forms buttons galore nearly impenetrable code a wide variety of examples of how to do various things a wider variety of examples of how NOT to do various things What I hope you’ll ‘get’ from today’s efforts Some ideas you can use in your applications Some boilerplate modules you can use with minimal fuss – confidence. Hey, if a dummy like me can get this far, think of how far you bright people can get!

March 25th, 2004John T. Anderson - AFE board test VBA Visual Basic For Applications (VBA) - AFE Board-level Test Package What to Expect Today –lots of

Embed Size (px)

Citation preview

Page 1: March 25th, 2004John T. Anderson - AFE board test VBA Visual Basic For Applications (VBA) - AFE Board-level Test Package What to Expect Today –lots of

March 25th, 2004 John T. Anderson - AFE board test VBA

Visual Basic For Applications(VBA) - AFE Board-level Test Package

• What to Expect Today– lots of graph objects

– forms

– buttons galore

– nearly impenetrable code

– a wide variety of examples of how to do various things

– a wider variety of examples of how NOT to do various things

• What I hope you’ll ‘get’ from today’s efforts– Some ideas you can use in

your applications

– Some boilerplate modules you can use with minimal fuss

– confidence. Hey, if a dummy like me can get this far, think of how far you bright people can get!

Page 2: March 25th, 2004John T. Anderson - AFE board test VBA Visual Basic For Applications (VBA) - AFE Board-level Test Package What to Expect Today –lots of

March 25th, 2004 John T. Anderson - AFE board test VBA

About as “basic” as VBA gets....

• Let’s look first at the “rm_generic” application on the server for the course.

• This is about as trivial an application as you can get. It was used make a 1553 Rack Monitor drive a few bits out in patterns to exercise some relays we had wired to it

– Bet you get an error opening it up! That’s one of the problems with auto-executing macros.

– Let’s take a minute and explore these items:• Code for ‘this workbook’

• Relay_tests module and usage of put_1553

• and, if you haven’t had enough versions already, I wrote a hex decoder too (third or fourth one you’ve seen by now, I’d bet)

Page 3: March 25th, 2004John T. Anderson - AFE board test VBA Visual Basic For Applications (VBA) - AFE Board-level Test Package What to Expect Today –lots of

March 25th, 2004 John T. Anderson - AFE board test VBA

OK, let’s get to the AFE board.

• Please close the RM_generic application and instead open up the “AFE_board_test.xls”.

• Allow me to talk to you a bit about navigation in the sheets– use of a ‘global parameters’ sheet

– spinner button for graphs

– we’ll just walk around a bit.

• The idea of this sheet was to make a test setup that would be used by someone who had no idea what the AFE does.– That’s fine, but it’s got more functions than a Swiss Army knife

• Just displayed as a bunch of sheets, the word ‘impenetrable’ comes to mind. I chose to use forms.

Page 4: March 25th, 2004John T. Anderson - AFE board test VBA Visual Basic For Applications (VBA) - AFE Board-level Test Package What to Expect Today –lots of

March 25th, 2004 John T. Anderson - AFE board test VBA

Forms, subforms, and makin’ code

• In what should come as no surprise, forms are just a collection of objects that you write code for to handle various events. You’ve seen that all before.

• Forms are just a trick to ‘hide’ that it’s Excel and make a more friendly interface

• Forms let you mix controls and display how you want it - sometimes a little nicer than the spreadsheet.

• Let’s go thru how it is done and tell war stories along the way.