Reading a string for the end

Reading a string for the end

Anonymous
Not applicable
423 Views
4 Replies
Message 1 of 5

Reading a string for the end

Anonymous
Not applicable
I need to read a string from the last character forward to find the first (actually the last in the string) time a character appears. VB has the InStrRev function but VBA doesn't seem to understand that. I am using the thisdrawing.fullname to read the current drawing name and path and I want to read the file name without the path. Is there an easy way to do this?
0 Likes
424 Views
4 Replies
Replies (4)
Message 2 of 5

Ed__Jobe
Mentor
Mentor
Why do you say it is not recognized? Works for me. Perhaps you just have a syntax error? You could also try the GetBaseName method of the FileSystemObject. -Ed

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 5

Anonymous
Not applicable
I am using ACAD 2000 and it not only doesn't have instrrev it does not have the getbasename. Any other ideas?
0 Likes
Message 4 of 5

Anonymous
Not applicable
Use thisdrawing.name instead of
fullname.

 

Bud


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
need to read a string from the last character forward to find the first
(actually the last in the string) time a character appears. VB has the
InStrRev function but VBA doesn't seem to understand that. I am using the
thisdrawing.fullname to read the current drawing name and path and I want to
read the file name without the path. Is there an easy way to do
this?
0 Likes
Message 5 of 5

Ed__Jobe
Mentor
Mentor
I can't remember when acad went from vba 5.0 to 6.0, but its possible that InStrRev was not in 5.0. Try typing the function in lowercase and see if Intellisense corrects it. If you have a reference to a missing file, it can cause vba to break on a regular vba function. It usually likes to stop on the MID function. But, the FileSystemObject is in the scripting runtime. Set a reference to "Microsoft Scripting Runtime". For more help, look at MSDN.microsoft.com.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes