Trapping characters from the activeproject name

P

Peter Rooney

Good morning,

Can anyone advise me as to how I could trap the characters up to the first
space in the activeproject name? So, for example, if the project was called
FRAIMS 26-10-05, I'd trap "FRAIMS", if it was CSL 26-10-05, I'd trap "CSL"
and so on.
I've tried to use the following:

FirstPartLength = Find(ActiveProject.Name, " ")-1

but all this does is display the FIND dialog box.

Thanks in advance

Pete
 
J

Jan De Messemaeker

Good Morning,

Hope this is VBA? The method is Instr as follows
Instr(activeproject.name," ")

HTH
 
P

Peter Rooney

Jan,

That's spot on!

I should have remembered this, but I've had my Excel VBA head on for a few
weeks!

Thanks a lot

Pete
 
J

Jan De Messemaeker

You're welcome, Peter

And BTW... It is a VBA function it is also available in Excel VBA :))
 
P

Peter Rooney

Jan,

As Homer would say "DOH!"

Every day in every way, I show my ignorance more and more! :))))

Thanks again

Pete
 
J

JackD

You might want to trim() the name first in case of leading spaces. They are
uncommon, but it could happen and cause an error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top