Showing results for 
Search instead for 
Do you mean 

LMS Test.Lab not able to read in block data

[ Edited ]



I'm new to the forums and LMS Test.Lab software. I have been following Test.Lab documentation and modifying some VBA code made by a coworker. I am trying to extend the exsisting functionality to pull in waterfall properties by implementing the following code:

Dim Nav_Selected As LMSTestLabAutomation.DataWatch
Dim Nav_Items As LMSTestLabAutomation.IData
Dim block_watch As LMSTestLabAutomation.DataWatch
Dim block_path As LMSTestLabAutomation.IData
Dim vblockpathindata As LMSTestLabAutomation.IData
Dim creationTime As String
Dim propBlock As LMSTestLabAutomation.IBlock2

Set Nav_Selected = TL.ActiveBook.FindDataWatch("Navigator_SelectedOIDs")
Set Nav_Items = Nav_Selected.Data
Set block_path = Nav_Items.AttributeMap(0)
Set block_watch = TL.FindDataWatch(block_path)

propBlock = block_watch.Data
creationTime = propBlock.Properties.Item("Created")

However, when I run the following code, I get the error that highlights "propBlock = block_watch.Data":

Compiler error: Invalid use of property

I'm confused because this is the exact implementation of loading a block to a local variable described in the automation.pdf documentation. It's likely I'm missing something very obvious. Thanks in advance for your help.


Re: LMS Test.Lab not able to read in block data

I think the only thing you are missing is a “Set” command before “propBlock”.   The line should read:

Set propBlock = block_watch.Data

In VBA, a set command is needed whenever you are assigning a value to an object (rather than assigning to a simple numeric or string variable).  "propBlock" was previously defined as an IBlock2 object.

Note that many of the examples provided with Test.Lab are written for VB.Net, which has some syntax differences compared to VBA.