LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,886
Default Extract all CN='Name' from a Active Directory data-dumped-cell

Thanks Luc.

Have to go out for the day now, and most of tomorrow, but may get time
to play with it at the weekend.
I added a
=SUBSTITUTE(extractUsers(a2),"*","")

Not sure whether the real data had names that the OP blanked out with
"*", or whether it was part of the format.


--
Regards

Roger Govier


"PapaDos" wrote in message
...
LOL
Not easy to see what the Replace method does...
I suggest you play with the Execute method to learn how regular
expressions
match...

By the way, my little function will probably leave a "," at the end of
the
users list with "real" data...

--
Regards,
Luc.

"Festina Lente"


"Roger Govier" wrote:

Thank you Luc, that fixed it.

Now, all I have to do is try and understand it!!!!!

--
Regards

Roger Govier


"PapaDos" wrote in message
...
Sorry, I should have mentioned it.
You need to add a reference to "Microsoft VBScript Regular
Expressions
5.5"
You do it through "Tools menu - References..." in the VBE
window...
--
Regards,
Luc.

"Festina Lente"


"Roger Govier" wrote:

Hi Luc

I have never used RegExp before and thought I would give this a
try.
I get a compile error - User defined type not defined as soon as I
try
to run it.

Could you please tell me what I need to do to make it work?

--
Regards

Roger Govier


"PapaDos" wrote in message
...
In a module:

Function extractUsers(s As String)
Dim re As New RegExp

re.Global = True
re.Pattern = "CN=([^,]+,?)([^;]+;)?"
extractUsers = re.Replace(s, "$1")
End Function

In B2:
=extractUsers(a2)

--
Regards,
Luc.

"Festina Lente"


"mateo561" wrote:

One of my Administrator types is dumping information from AD so
some
mid-level manager can justify his position and salary (too
sarcastic?? ;-)..
anyway.. AD dumps very verbose information into his cells.

Example: In cell A2 you have...

CN=Daniel ****,OU=Desktops,OU=Users,OU=Executive
Offices,OU=FCC,DC=Sugar,DC=corp;CN=Rich
******,OU=Laptops,OU=Users,OU=Service
Center,OU=FCC,DC=Sugar,DC=corp;CN=Charles ******... and on and
on.

(names changed to protect the innocent)

these text stings get very long.. some even hit the character
limit
for
cells.. but all that my guy wants are the names of the users,
which
of course
are represented after the "CN=" and ends with the next ","

Desired Result: In cell B2 show...
Daniel ****, Rich ******, Charles ******

I can easily pull "Daniel ****" using text functions but I lose
it
when I
have then find Rich, and Charles, and Tom, Dick and Harry..
until
somewhere,
someplace it all ends with the LAST name which could be 7
names,
32
names, or
124 names.

So off to the Excel Discussion Groups to nab.. Do'h... 'use'
some
VBA
from
someone who really knows what they are doing.

I have been searching through your forums, reading VB questions
from
the
unwashed masses and checking out the suggestions from the
enlightend
ones.
Visited sites like contextures, peltiertech, cpearson and more.
I
have tried
to modify some code that was posted both on this forum and
others
and
learned
alot of good, although ancillary, stuff in the process.

I now post this questions to the world, as I am brain fried,
body
tired, mad
at myself for not being smarter (or better looking) and
besides, I
am
out of
alcohol.

Any help in this issue would be much appreciated and it sure
would
make me
look good to those mid-level managers as well. I have used
this
forum
numerous times in the past and you folks have always come
through
to
enlighten my brain and boost my intellect (at least in the eyes
of
those
managers).

So thanks in advance and I hope you make me look good yet
again!

Version: Excel 2003 SP2











 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract Data From Active Directory Adrian Excel Programming 1 August 23rd 06 11:44 PM
Data Connection - Active Directory Rob Excel Discussion (Misc queries) 1 August 11th 06 06:56 PM
How to extract just the Column Name of the active cell Fred Excel Discussion (Misc queries) 4 December 8th 05 06:24 PM
active directory? Tim[_39_] Excel Programming 0 August 15th 04 08:34 AM
Active Directory Ulf Nilsson Excel Programming 2 April 27th 04 07:08 AM


All times are GMT +1. The time now is 08:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"