Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

how to capture waveform using macro excel 2007 with lecroy activedso object

Solved!
Go to solution

 

Good morning everyone..

I hope you could help me.

 

INQUIRY:

 

     i have a macro code but there is no image output displayed in specified activedso object after successfully connected in specified IP address.

     i think there is a problem in specifying activedso object.

 

MACRO CODE:

 

Private Sub CommandButton1_Click()

Dim o As Object
Dim success As Boolean

Set o = CreateObject("LeCroy.ActiveDSOCtrl.1")
ipadd = ActiveSheet.Range("B1").Value   'ip address value in specific cell

With ActiveSheet.OLEObjects("ActiveDSO1")
    success = o.MakeConnection("IP: " & ipadd)  'if true, capture current image of waveform from lecroy digital osci and displayed in activedso object
    If (success = False) Then
        MsgBox "DSO not found ! Address may be wrong ...  " & o.ErrorString
        GoTo 999
    End If
End With

999 Set o = Nothing

End Sub

 

if there are some questions or conflict in my inquiry please feel free to reply.

 

 

0 Kudos
Message 1 of 14
(8,660 Views)

Hello Jeff,

 

ActiveDSO comes with some examples done in Excel.

 

None of them have the control embedded though.

 

With the control embedded, you can use the "Refresh Image" method.

 

All of the ActiveDSO methods and properties are explained in the help file and show examples of their use in VBA.

 

You can also manually use the control.

 

Right click on the control and select "Make Connection".  On the resulting dialog, select "Network/VICP" and enter the IP address.

 

Once you get the connection established, you can right click and select "Refresh Image" to get a screen shot from the scope.

 

The help and examples folders for ActiveDSO can be found at:  START\All Programs\LeCroy\ActiveDSO\...

 

Regards,

Leonard Brown
Applications Engineer
Teledyne LeCroy
1-800-553-2769

Message 2 of 14
(8,625 Views)

Good day leonard,

 

 

Its a pleasure to meet you sir. Thank you very much for your response.

 

I'am aware in how to capture the waveform manually.i need to remove the manual procedure in capturing waveform and automate it in just 1 click with macro excel commandbutton.

 

For the Acvtivedso "HELP" it doesn't give information result that i need. And also for VBA samples codes in activedso, i already using it, still there's a problem.

 

Hoping for your support.

 

 

Thanks again.

 

 

0 Kudos
Message 3 of 14
(8,613 Views)

Hi Jeff,

 

 

Thanks for the added information.

 

 

I took your code snippet and used it with my spread sheet to do this.

 

 

I am by no means a VBA developer (I was a "Certified LabVIEW Architect for a while, but I let it go when I came to TeledyneLeCroy).

 

 

I find that I can click on the control and connect to the scope and grab an image, but I have to either right click and tell it to refresh, or change the focus away from the control and then click back on it to repeat the process. (The control is not like a button so it does not turn off for me to click it again).

 

 

 

All I did was to change the "o" to "ActiveDSO1" used in the With statement.

 

I did this for the refresh image as well.

 

My thought is that you can modify this macro to add a button to do all of this, or add a line in the function to move the focus away from the control after we connect, get an image, and disconnect.

 

Regards,

Leonard Brown
Applications Engineer
Teledyne LeCroy
1-800-553-2769

Message 4 of 14
(8,602 Views)

Good day leonard!

 

Sorry for the late reply!

I already used the revised code and its really working!thank you so much! ive been debuggng it for so long!

I think too much in how to use the "o" as object.now i learned how to use the activedso automatically.

 

Anyway, let me introduce myself.

I am Failure Analysis Engineer in HDD company and specialize in developing Failure Analysis system/process using VBA programming and other languages such as C++, Php and VB.net.

But not superior in my current field.

 

I have a question. Is it possible to save the ActiveDSO image as *.bmp/*.jpg in a specific folder. or copy it as *.jpg and paste it in specific cell and image size?

 

It a pleasure to meet you leonard.

 

Regards,

 

Jeff

FA Engineer

 

 

 

0 Kudos
Message 5 of 14
(8,473 Views)
Solution
Accepted by jeff_tip

Hello Jeff,

 

It is also a pleasure to meet you!

 

There is a "StoreHardcopyToFile" method you can use to get an image and store it on your PC.

 

Here is an image from the ActiveDSO help file showing the method along with a VBA example for using it.

 

Capture.JPG

 

Let me know if you have any challenges.

 

Regards,

Leonard Brown
Applications Engineer
Teledyne LeCroy
1-800-553-2769

 

Message 6 of 14
(8,455 Views)

Good day leonard!

 

Thank you so much! This is what we need. Your a savior leonard. 🙂

 

It really works fine. i improve he code to achieve desired output.

 

last question leonard. where i can search this source code from ACTIVEDSO help file? My help file doesnt give me the right information for VBA activedso codes.

 

Is there any PDF file where i can download for free?

 

i have one more thing that i need to add in my code to achieve my desired output, like saving the image in "GridArea only".

 

 

Thanks and regards,

 

Jeff

FA Engineer

0 Kudos
Message 7 of 14
(8,375 Views)

Hi Jeff,

 

I am glad I could help.

 

The help file for ActiveDSO only has examples of the methods and properties that are built in to the control.

 

You will need to use the WriteString method to send the remote command to setup the "Grid Area Only" selection.

 

When we talk about remote control of the scope, we have two different command sets.  One is called "remote" and the other, we refer to as "automation" or "XStream Browser" commands.

 

Here is a link to an FAQ on the subject:  Remote Control

 

There are links from the FAQ to the remote and automation documentation, and it points to page numbers in the manuals that will help.

 

Here is  link to a tutorial on the XStream Browser (I recommend getting familiar with this application as it will eliminate most of the need for the automation documentation).

XStream Browser Tutorial

 

So, here is what you will need to do to setup the "Grid Area Only":

 

Call o.WriteString ("VBS 'app.Hardcopy.HardcopyArea = GridAreaOnly"",True)

 

Notice the single quotes around the "automation" command.

 

Let me know if I can help with anything else!

 

Regards,

Leonard Brown
Applications Engineer
Teledyne LeCroy
1-800-553-2769

 

Message 8 of 14
(8,367 Views)

 

Good day leonard,

 

Thanks again for your continuous support. Smiley Happy

I already read the tutorial and download the pdf files for remote and automation. it gives me a lot of information in how to use the activedso and xtreamdso.

I made some revision in your code. Only remove the excess quotation to prevent error in macro excel.

 

this revised code is working in configuring the hardcopy area to Gridareaonly.

Call o.WriteString("VBS 'app.Hardcopy.HardcopyArea=GridAreaOnly'", True)

 

But i think something missing in storehardcopytofile method(referring to red highlighted quotation). if this one is solve maybe the above code can be remove.

Call ActiveDSO1.StoreHardcopyToFile("JPG", "", pPath)

 

Even the code for GridAreaOnly is effective, the captured image is still set to DSOWindow after executing storhardcopytofile.

Here is the sample image:

BMPImage.jpg

 

Capture.JPG

 

Thanks a lot again leonard.

 

Reagrds,

Jeff

FA engineer

Lecroy Digital Oscilloscope user

 

 

 

 

 

 

 

0 Kudos
Message 9 of 14
(8,306 Views)

Hi Jeff,

 

Change "jpg" to "JPEG" and make sure the path is correct.

 

Here is the line of code I used:

 

Call o.StoreHardcopyToFile("JPEG", "", "C:\LeCroy\XStream\Hardcopy\testimage.jpg")

 

I will have to check on using a variable for the path and file name.  (You may need to add the double quotes around it if they are not part of the variable value).

 

Regards,

Leonard Brown
Applications Engineer
Teledyne LeCroy
1-800-553-2769

 

0 Kudos
Message 10 of 14
(8,295 Views)