VB Code help (code line to remove text before "-")
VB Code help (code line to remove text before "-")
(OP)
I was needing a command line to remove the beginning part of an output file currently being produced by our VB program. I am using a program that creates a PDF into a certain file structure. With recent filenaming sructure changes, I need to remove part of the output file. (see example below)
Output file: ABC12345-E1234567E00_1.pdf
or : 12345678-E1234567E00_1.pdf
I was needing to remove the first part of the file before the "-".
I need a new output to be: E1234567E00_1.pdf
It will need to be a IF THEN statement also. There is another file structure that already gets me to the correct file format.
Thank you,
Allen
Output file: ABC12345-E1234567E00_1.pdf
or : 12345678-E1234567E00_1.pdf
I was needing to remove the first part of the file before the "-".
I need a new output to be: E1234567E00_1.pdf
It will need to be a IF THEN statement also. There is another file structure that already gets me to the correct file format.
Thank you,
Allen
Current version: NX 5.0.4.1





RE: VB Code help (code line to remove text before "-")
CODE
dim pos as integer
strInput = "12345678-E1234567E00_1.pdf"
'look for position of hyphen
pos = InStr(strInput, "-")
'if hyphen is found, trim off all characters before hyphen (+1 to trim hyphen as well)
if pos > 0 then
strInput = Mid(strInput, pos + 1)
end if
RE: VB Code help (code line to remove text before "-")
I had to modify it a bit to incorporate my existing "StrInput" file. I was able to use the main portion and make it work for us.
Thanks a lot,
Allen
Current version: NX 5.0.4.1
RE: VB Code help (code line to remove text before "-")
Glad I could help.