I tried to trim the leading and trailing text and it works fine until I got the text with double quote ["].
How can we replace it with different character or delete it before call a VBScript functions related to string?
Please help me since I stuck from here and can't poke data from excel to an array.
Any help will be appreciated. Thank you so much in advance.
I post the code below to let you look on your computer to see what I mean.
VBSTART
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Add
objExcel.Visible = True
VBEND
Wait>1
Press CTRL
Press Home
Release CTRL
Wait>0.5
Press Down
' Enter the val " ABC". The leading space is 2 spaces.
Send> This string has double quote as " that I can not trim it
Press Enter
' Move up to cell(2,1)
Press Up
Wait>0.5
Press CTRL
send>c
Release CTRL
Wait>0.5
GetClipBoard>val
Wait>0.5
MessageModal>val
' The result should be ABC without leading space
GetClipBoard>val
Length>val,lv
Let>lv=lv-2
MidStr>val,1,lv,val
VBEval>Trim("%val%"),val
MessageModal>val
Can't pass a string with double quote ["] to VBScript
Moderators: JRL, Dorian (MJT support)
Can't pass a string with double quote ["] to VBScript
Best regards,
Have a great day
Richard Myer, sale rep.
Have a great day
Richard Myer, sale rep.
This little trick will convert a string surrounded by quotes to one without them:
Let>Val="ABC"
VBEval>%val%,val
Let>Val="ABC"
VBEval>%val%,val
MJT Net Support
[email protected]
[email protected]
I am sorry not to make myself clear.
I have a Product Title in the excel cell from cutomer that I can't alter it and I can't tell the customer use inch instead of ".
Example: NEW Craftsman Microtork 3/8" Torque Wrench
When I try to copy this title from Excel cell to the clipboard and then assign to a variable, after that, I call a Trim function from VBScript. It seems it doesn't like it.
It keep saying syntax error. It might confuse with the string double quote
" NEW Craftsman Microtork 3/8" Torque Wrench". Since it has 3 double quotes.
How can I remove the single quote after 3/8 before passing to the VBScript function?
Below it the first code i rewrited it to make mysel clear. It gave me the error,
The same second code but I deleted " in Product Title and it worked well.
First MS Script
VBSTART
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Add
objExcel.Visible = True
VBEND
Let>SK_DELAY=10
Wait>1
Press CTRL
Press Home
Release CTRL
Wait>0.5
Press Down
' Product Title: NEW Craftsman Microtork 3/8" Torque Wrench
Send> NEW Craftsman Microtork 3/8" Torque Wrench
Press Enter
' Move up to cell(2,1)
Press Up
Wait>0.5
Press CTRL
send>c
Release CTRL
Wait>0.5
GetClipBoard>val
Wait>0.5
MessageModal>val
' The result should be:NEW Craftsman Microtork 3/8" Torque Wrench
GetClipBoard>val
Length>val,lv
Let>lv=lv-2
MidStr>val,1,lv,val
VBEval>Trim("%val%"),val
MessageModal>val
Second MS Script
VBSTART
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Add
objExcel.Visible = True
VBEND
Let>SK_DELAY=10
Wait>1
Press CTRL
Press Home
Release CTRL
Wait>0.5
Press Down
' Product Title: NEW Craftsman Microtork 3/8" Torque Wrench
Send> NEW Craftsman Microtork 3/8 Torque Wrench
Press Enter
' Move up to cell(2,1)
Press Up
Wait>0.5
Press CTRL
send>c
Release CTRL
Wait>0.5
GetClipBoard>val
Wait>0.5
MessageModal>val
' The result should be:NEW Craftsman Microtork 3/8" Torque Wrench
GetClipBoard>val
Length>val,lv
Let>lv=lv-2
MidStr>val,1,lv,val
VBEval>Trim("%val%"),val
MessageModal>val
I
I have a Product Title in the excel cell from cutomer that I can't alter it and I can't tell the customer use inch instead of ".
Example: NEW Craftsman Microtork 3/8" Torque Wrench
When I try to copy this title from Excel cell to the clipboard and then assign to a variable, after that, I call a Trim function from VBScript. It seems it doesn't like it.
It keep saying syntax error. It might confuse with the string double quote
" NEW Craftsman Microtork 3/8" Torque Wrench". Since it has 3 double quotes.
How can I remove the single quote after 3/8 before passing to the VBScript function?
Below it the first code i rewrited it to make mysel clear. It gave me the error,
The same second code but I deleted " in Product Title and it worked well.
First MS Script
VBSTART
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Add
objExcel.Visible = True
VBEND
Let>SK_DELAY=10
Wait>1
Press CTRL
Press Home
Release CTRL
Wait>0.5
Press Down
' Product Title: NEW Craftsman Microtork 3/8" Torque Wrench
Send> NEW Craftsman Microtork 3/8" Torque Wrench
Press Enter
' Move up to cell(2,1)
Press Up
Wait>0.5
Press CTRL
send>c
Release CTRL
Wait>0.5
GetClipBoard>val
Wait>0.5
MessageModal>val
' The result should be:NEW Craftsman Microtork 3/8" Torque Wrench
GetClipBoard>val
Length>val,lv
Let>lv=lv-2
MidStr>val,1,lv,val
VBEval>Trim("%val%"),val
MessageModal>val
Second MS Script
VBSTART
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Add
objExcel.Visible = True
VBEND
Let>SK_DELAY=10
Wait>1
Press CTRL
Press Home
Release CTRL
Wait>0.5
Press Down
' Product Title: NEW Craftsman Microtork 3/8" Torque Wrench
Send> NEW Craftsman Microtork 3/8 Torque Wrench
Press Enter
' Move up to cell(2,1)
Press Up
Wait>0.5
Press CTRL
send>c
Release CTRL
Wait>0.5
GetClipBoard>val
Wait>0.5
MessageModal>val
' The result should be:NEW Craftsman Microtork 3/8" Torque Wrench
GetClipBoard>val
Length>val,lv
Let>lv=lv-2
MidStr>val,1,lv,val
VBEval>Trim("%val%"),val
MessageModal>val
I
Best regards,
Have a great day
Richard Myer, sale rep.
Have a great day
Richard Myer, sale rep.