From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

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

Hello leonard,

 

Im sorry i didn't put the value of pPath

Here is my revised code.

 

Public Sub lecroy_digi()

 

Dim o as Object

Dim pPath As String
Dim ipadd As String

 

Set o = CreateObject("LeCroy.ActiveDSOCtrl.1")
ipadd = ActiveSheet.Range("A1").Value
pPath = "C:\WAVEFORMS\BMPImage.jpg"

 

Call ActiveDSO1.MakeConnection("IP: " & ipadd)
Call ActiveDSO1.WriteString("VBS 'app.Hardcopy.HardcopyArea=GridAreaOnly'", True)  '<<< code is effective, it can change the setup to "GridAreaOnly" in oscilloscope
Call ActiveDSO1.StoreHardcopyToFile("JPEG", "", pPath)   '<< working but still the problem, hardcopy area is  in "DSOWindow" setup not in "GridAreaOnly"

 

With ActiveSheet.Pictures.Insert(pPath).Select
    Wid = Selection.Width
    Hei = Selection.Height
    Ratio = Wid / Hei
    Selection.Delete
End With
       
With ActiveSheet.Shapes.AddPicture(pPath, False, True, 0, 0, 179, (179 / Ratio))
    '.PictureFormat.CropTop = 24        ' <<< need to remove this and replaced with GridAreaOnly setup
    '.PictureFormat.CropBottom = 54
    .Top = ActiveCell.Top
    .Left = ActiveCell.Left
    .LockAspectRatio = True
    .Placement = xlMoveAndSize
End With

 

Call ActiveDSO1.Disconnect

 

End Sub

 

If you have any clarification, please feel free to reply.

 

Thanks and regards,

Jeff

FA Engineer

Lecroy user

0 Kudos
Message 11 of 14
(3,143 Views)

Hi Jeff,

 

I probably just did not look at your comment about the DSO Window vs. the Grid Area.

 

I also did not notice the change back to the default value so I thought it would work for you as well.

 

Although the first command does set it, the storehardcopy function resets it to the default value.

 

Add "AREA,GRIDAREAONLY"  between the emtpy double quotes, and make sure to add the double quotes around the path.

 

The pPath variable does not include the double quotes around it and it appears to need them in the command. (I am running all of this from Excel and will need to find the right way to add them with a CHAR(XX)).

 

Here is my snippet that worked for me:

 

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

 

Regards,

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

 

 

 

Message 12 of 14
(3,125 Views)

Good day leonard!

 

Thank you very much!

 

This code is really working!

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

 

All inquiry are SOLVED! Smiley Happy

 

Regards,

 

Jeff

Lecroy Digital Oscilloscope user

0 Kudos
Message 13 of 14
(3,111 Views)

Hi Jeff,

 

It was my pleasure to help out!

 

I am glad you got it all going.

 

Happy coding!

 

Regards,

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

 

0 Kudos
Message 14 of 14
(3,105 Views)