ࡱ> 463M bjbj== ",WWlfffffffz| | | | 4z bdddddd$ f l ff l l l "f f bl bl :l ff q-nz| 0Yl Yl zzffffExcel Toolbar Code Notes General Description The Excel Toolbar is an Excel Add-In (an .xla file) that employs the TekVISA ActiveX control for all communication with TDS 1000 TDS 8000 series oscilloscopes. Descriptions of its functionalities are available in the online help file as well as in the Oscilloscope Analysis and Connectivity Made Easy book and PDF file. The Excel toolbar code is comprised of the following modules: Module NameModule TypeDescriptionfrmConnectMSOffice UserForm (MSForms Library)Lists open GPIB compliant oscilloscope to which users may connect.frmHoldTVCMSOffice UserForm (MSForms Library)Form for holding the TVC control.frmMeasurementMSOffice UserForm (MSForms Library)Form for capturing/graphing measurements triggered by a user click or user-specified timed interval. For the 5000/7000 series scopes, these are GPIB immediate measurements (i.e. employs the MEASU:IMMED GPIB command. For the 8000 scope, these are user-specified measurements (i.e. uses MEASU:MEASx GPIB commands). frmSettingsMSOffice UserForm (MSForms Library)Allows the user to save the results of a LRN? Query into a file or into a spreadsheet. frmTriggerMSOffice UserForm (MSForms Library)Applies to 5000/7000 series scopes only. Captures specified immediate measurements and/or waveforms on a triggered event. Relies upon the TVC control ServiceRequest event.frmWFMMSOffice UserForm (MSForms Library)Captures and optionally graphs a channel waveform, triggered by a user click.ToolbarCodeMSOffice code moduleModule for holding generic application routines plus some lengthier routines that apply to individual Userforms (e.g. populating arrays.)EngFormatMSOffice code moduleModule that holds engineering unit conversion and formatting functions.clsAPPEventsMSOffice class moduleClass module for holding an Application object reference for synchronizing an Excel Application level event (WorkbookOpen event). This is used to automatically assign saved settings to the scope when a workbook is opened.P_TimedMeas.dllActiveX DLLA VB-coded ActiveX DLL that is used to send measurement queries to the scope and pass the results to p_ExcelInsert.exe This DLL holds a timer within it and is referenced in the Toolbar code by the publicly scoped tmrGM variable on frmMeasurement (see below as well as Architecture section).P_ExcelInsert.exeActiveX EXEA VB coded ActiveX EXE that is used to insert measurement results and charts into the Excel spreadsheet on timed measurements (see Architecture section below). ThisWorkbook MSOffice ObjectCaptures the following events for the .xla Workbook itself: Workbook_Activate Workbook_BeforeClose Workbook_Open  Custom controls In addition to the ActiveX components used above, the Excel toolbar uses the following ActiveX custom controls: TVC ActiveX control (tvc.ocx) Microsoft Common Dialog Control (COMDLG32.ocx) Microsoft masked Edit control (MSMASK32.ocx) Architecture The architecture of the Excel toolbar is straightforward for the most part. Most code is held by the individual MSForms. If the Excel toolbar has been selected as an Add-In, the toolbar is built when Excel is launched (see ThisWorkbook object events) and is torn down when the ThisWorkbook object is closed. With a few exceptions, the individual form modules avail themselves of generic routines in the ToolbarCode code module. Several globally scoped objects are used by all forms, most importantly the tvcRef reference variable which is bound to the TVC control on the frmHoldTVC form. The only complex architecture is used to handle timed measurements. Multiple Immediate GPIB measurements taken and inserted into a spreadsheet at short intervals can hang the toolbar. To employ multithreading in this situation, an instance of p_TimedMeas.dll is created and this DLL is passed a reference to the TVC control on frmMeasurement, a reference to an instance of the p_ExcelInsert ActiveX EXE, timing interval and duration data, and a GPIB query command. Using a VB timer control, the DLL executes the GPIB command at the interval specified and passes the result string to the p_ExcelInsert ActiveX Exe. The ActiveX EXE is configured with user charting and target range choices when it is created. It parses the results passed to it by p_TimedMeas, pastes them into the spreadsheet, and creates a chart of the measurements if the user has made these choices. At the end of the timed measurement, or if the user chooses to stop taking measurements, the instances of p_TimedMeas.DLL and p_ExcelInsert are destroyed. Code Descriptions The code is fairly well commented throughout. One design decision was to use an array of a User Defined Type (struct) for holding measurement information (see the MeasureData structure). Since measurement information may not remain static, routines update unit elements in the arrays before measurements are taken. Miscellaneous Notes If you decide to rebuild the MSForms with newer or revised versions of Active controls, you MUST remember to delete the .EXD files that map custom control information to MSForms. If you dont, your ActiveX control upgrades have no effect. Recompiling the MSForms rebuilds the .EXD files. The .EXD files may be found under Windows\MSApps\MSForms. .-]wx:; Ym6CJ5CJ 6CJ]CJ 5CJ\5\./qrx|$$IflFpH," 0    4 la$If HITx  ;|H||(|$$IflFpH," 0    4 la$Ifq r y t||||||||||$If|$$IflFpH," 0    4 la #     D E W c | |||$$IflFpH," 0    4 la$If$`v%t|||||||zxzz$If|$$IflFpH," 0    4 la %&Ds^_ijklWYmn ` ` 1h/ =!"#$% i8@8 NormalCJ_HaJmH sH tH 66 Heading 1$@& 5CJ\<A@< Default Paragraph Font*B* Body TextCJ*O* HeaderRM5\.U@. Hyperlink >*B*ph,./qrHITx  ;qry  #D E W c    $ ` v % & D s ^ _ ijklWYmn000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %  IS rxZd 333333333 TektronixYC:\WINDOWS\Application Data\Microsoft\Word\AutoRecovery save of ExcelToolbarCodeNotes.asd TektronixYC:\WINDOWS\Application Data\Microsoft\Word\AutoRecovery save of ExcelToolbarCodeNotes.asd TektronixYC:\WINDOWS\Application Data\Microsoft\Word\AutoRecovery save of ExcelToolbarCodeNotes.asd TektronixYC:\WINDOWS\Application Data\Microsoft\Word\AutoRecovery save of ExcelToolbarCodeNotes.asd TektronixYC:\WINDOWS\Application Data\Microsoft\Word\AutoRecovery save of ExcelToolbarCodeNotes.asd Tektronix-C:\Demos\VISADemos\ExcelToolbarCodeNotes2.docbadmal\\el188734\c$\misc\sst120.doc Wendell Damm<C:\phyllis\Charm\080701\from badri\TekVISA Toolbar Notes.doc Wendell DammYC:\WINDOWS\Application Data\Microsoft\Word\AutoRecovery save of TekVISA Toolbar Notes.asd Don ZocchiD:\TekSrc\CHARM TEKVISA INSTALL\CD-ROM Distribution Files\SAMPLES\OscilloscopeAnalysisAndConnectivityMadeEasy\Ch2\TekExcel Toolbar Notes.docHITx  ;qry  #D E W c    $ @t@@UnknownGz Times New Roman5Symbol3& z Arial"qhLXQBjF %$!0d2(Charm Project  Excel Toolbar Code Notes Tektronix Don ZocchiOh+'0 ,8 T ` lx)Charm Project Excel Toolbar Code Notesordhar Tektronixecektekt Normal.dotc Don Zocchic5n Microsoft Word 9.0e@hx@ W ?!@L!n%՜.+,0 hp|   $ )Charm Project Excel Toolbar Code Notes Title  !"$%&'()*,-./0125Root Entry F,-n71TableYWordDocument",SummaryInformation(#DocumentSummaryInformation8+CompObjjObjectPool,-n,-n  FMicrosoft Word Document MSWordDocWord.Document.89q