Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VBA Code to read a substring
#1
Not Solved
Hello All 

I am new to automation using UFT and new to programming as well. My question is around how to manipulate Substrings (a string within a string)
I want to find the position of a certain character in the string and find its start position and pass this start position to the mid function to capture the 
substring. The reason I need the position is because the position of the substring keeps moving. 

I also have it in a Do Loop Until 

Do
Window("Warehouse Management.ws").Type  micF5
Wait (2)
Window("Warehouse Management.ws").WinObject("Workstation ID:").Output CheckPoint("Workstation ID:_2")
L_Sline2 = DataTable.Value("G_Status_20",Global)
L_Status_20 = Instr(L_Sline2,"20 Print")
L_Status_20_Valid = mid(L_Sline2,L_Status_20,8)
Loop Until L_Status_20_Valid = "20 Print"

I keep getting the error "invalid procedure call or argument: 'mid'" The line with the error is underlined 

Could someone take a look at this one please......
Reply
#2
Not Solved
Please show an example of what you want exactly.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Not Solved
Yes Please show an example..

Sample snipet -> hope you might be right track

strstring = "Unified"
strlen = Len(strstring)
Character = "f"

''Gets Length of the string
Msgbox strlen

CharacterPosition = Instr(1,strstring,Character)

''Gets Position of character
Msgbox CharacterPosition
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Want to read the data from excel and set read value in the JavaTable rajeevk7 0 2,304 07-10-2017, 04:20 PM
Last Post: rajeevk7
  Find out if QTP is running using VBA TurtleRock 0 2,167 09-07-2012, 04:53 PM
Last Post: TurtleRock
  VBA Application in Excel seema 0 1,830 08-28-2008, 04:29 AM
Last Post: seema
  Substring Anna 3 10,105 07-21-2008, 03:16 PM
Last Post: bhanu_bp7

Forum Jump:


Users browsing this thread: 1 Guest(s)