Call TekXL Screen Capture from user-defined macro?

TheWaterbug

New Member
Joined
Feb 4, 2016
Messages
15
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
Platform
  1. Windows
  2. MacOS
Background:
  1. Many years ago Tektronix wrote some brilliant software (The TekVISA toolbars) to allow users to bring screen captures (or waveform data) from their oscilloscopes into Excel (or Word) with just a click.
    1. 1687375787933.png
    2. The software was free, and worked very well, and we used it all the time.
      1. It worked over GPIB, TCP/IP, or even Serial, though I never attempted serial.
    3. Then some stuff broke when we all transitioned over to 64-bit Windows and 64-bit Office, and much knowledge was lost.
      1. Their newer, 64-bit stuff is subscription-only :mad:
    4. I recently spent a few days figuring out what broke, and I got it working again!!!!! Short version:
      1. Install the 32-bit versions of Microsoft Office, TekVISA, and the TekVISA Toolbars
      2. Manually copy the toolbar template files to %OFFICEROOT%\startup and \xlstart
      3. Add those directories as Trusted Locations to the Office Trust Center
      4. Long version, with step-by-step directions and links, here.
  2. But in the intervening years I forgot how to do something that I'd figured out way back when:
The Quest:
  1. Back in 2010 I somehow found a way to call the TekXL Screen Capture macro in a loop from a user-defined macro.
    1. TekXL Screen Capture is normally called by a toolbar click, but I wanted to call it from other software.
    2. In our own application we changed a value in our hardware to move a signal, exported some of our internal data to Excel, and executed the TekXL macro to request a screen capture.
    3. After 100 loops I had 100 screen captures layered on top of each other, but if I renamed the .xlsx as .zip and unzipped, all the PNGs were in a separate folder with incrementing filenames, and then it was easy to turn them into a movie:
  2. I can't remember how I was able to call TekXL Screen Capture, but now I want to do it again.
    1. Actually I want to call TekXL Waveforms, but that's a bit more involved, so I want to start by seeing if I can just reproduce what I did back in 2010!
    2. If I look into the Tektronix toolbar code, it shows the following to install the toolbar button:
      1. VBA Code:
        Call AddToolbarButton("TekXL Screen Capture", "btnVHardcopy_Click", 190)  '6, 527)
    3. and further down there's this function:
      1. VBA Code:
        Private Sub btnVHardcopy_Click()
    4. which calls:
      1. VBA Code:
        Call GetHardCopy
    5. But attempting either:
      1. VBA Code:
        Call btnVHardcopy_Click
      2. or
      3. VBA Code:
        Call GetHardCopy
    6. from a macro in another workbook results in:
      1. Code:
        Compile error:
        Sub or Function not defined
Any hints on how to call a private function from another macro? I know I did this once, because I have the movie to prove it! But I can't find the Excel file that contained the macro that I wrote.

Thanks!
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Some progress on this. This almost works:

VBA Code:
Sub InsertScopeCapture()
    Application.Run "ToolbarCode.btnVHardcopy_Click"
End Sub

in that it works only if I've opened Excel manually, and the TekXL add-in toolbar loads automatically. If I have that VBA in a module in my opened workbook, and run it from the Macros menu, then I get the screen capture I want.

The problem is that, when my own application opens the .xls or .xlsm containing my macro, Excel doesn't load the TekXL add-in toolbar. The Add-in menu doesn't even show up, so my macro function call fails. If I pause my application and attempt to load the Add-in or attempt to load TekXLToolbar.xla or even make an explicit call to:

VBA Code:
Application.Run "'C:\Program Files (x86)\Microsoft Office\root\Office16\XLSTART\TekXLToolbar.xla'!ToolbarCode.btnVConnect_Click"

(another button on that toolbar that must be select the oscilloscope prior to taking any screen captures)

then Excel hangs.

I suspect it's something in the security model that has changed since 2010, because somehow or other this used to work.
 
Upvote 0

Forum statistics

Threads
1,223,867
Messages
6,175,062
Members
452,610
Latest member
Sherijoe

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top