document.new
I get the userid from a module and want to populate a text field with the
user's phone extension.
Here's an example of user's and phone ext:
bjsorens336
rewelin415
reellis613

Thanks,
Bryan

Re: Arrays by Graham

Graham
Sat Nov 24 05:59:24 PST 2007

You haven't given enough information to do more than stab a guess at what
you are doing however

Dim sExtension As String
sExtension = Right(UserID, 3)
ActiveDocument.FormFields("Text1").Result = "Ext: " & sExtension

will put the last three characters that form the extension number of your
variable UserID in a text form field Text1

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

bryan wrote:
> document.new
> I get the userid from a module and want to populate a text field with
> the user's phone extension.
> Here's an example of user's and phone ext:
> bjsorens336
> rewelin415
> reellis613
>
> Thanks,
> Bryan



Re: Arrays by bryan

bryan
Sat Nov 24 06:44:01 PST 2007

In vb, how do I do a lookup of a value in an array or table of elements.
ie bjsorens is my userid, how do I lookup in the array to get 336 where the
array is biult in with values of users and ext?
Again the array or table would have a userid of 8 length and ext of 3 length
bjsorens 336
rewelin 415
reellis 613

If usewr is bjsorens, how do I look up in this array to get 336?

Thanks,
Bryan


"Graham Mayor" wrote:

> You haven't given enough information to do more than stab a guess at what
> you are doing however
>
> Dim sExtension As String
> sExtension = Right(UserID, 3)
> ActiveDocument.FormFields("Text1").Result = "Ext: " & sExtension
>
> will put the last three characters that form the extension number of your
> variable UserID in a text form field Text1
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com
> Word MVP web site http://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
> bryan wrote:
> > document.new
> > I get the userid from a module and want to populate a text field with
> > the user's phone extension.
> > Here's an example of user's and phone ext:
> > bjsorens336
> > rewelin415
> > reellis613
> >
> > Thanks,
> > Bryan
>
>
>

Re: Arrays by bryan

bryan
Sat Nov 24 09:02:00 PST 2007

A little more clarity
I have variable strUserID.
I want to get the 2nd dimentional value where strUserID = the 1st
dimentional value.
Coming from the AS/400 world I can do this with a lookup in a compile time
array.
Something like:
stringA lookup array1
if %found
move array2 txt1
endif

Thanks,
Bryan



"bryan" wrote:

> In vb, how do I do a lookup of a value in an array or table of elements.
> ie bjsorens is my userid, how do I lookup in the array to get 336 where the
> array is biult in with values of users and ext?
> Again the array or table would have a userid of 8 length and ext of 3 length
> bjsorens 336
> rewelin 415
> reellis 613
>
> If usewr is bjsorens, how do I look up in this array to get 336?
>
> Thanks,
> Bryan
>
>
> "Graham Mayor" wrote:
>
> > You haven't given enough information to do more than stab a guess at what
> > you are doing however
> >
> > Dim sExtension As String
> > sExtension = Right(UserID, 3)
> > ActiveDocument.FormFields("Text1").Result = "Ext: " & sExtension
> >
> > will put the last three characters that form the extension number of your
> > variable UserID in a text form field Text1
> >
> > --
> > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> > Graham Mayor - Word MVP
> >
> > My web site www.gmayor.com
> > Word MVP web site http://word.mvps.org
> > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> >
> > bryan wrote:
> > > document.new
> > > I get the userid from a module and want to populate a text field with
> > > the user's phone extension.
> > > Here's an example of user's and phone ext:
> > > bjsorens336
> > > rewelin415
> > > reellis613
> > >
> > > Thanks,
> > > Bryan
> >
> >
> >

Re: Arrays by bryan

bryan
Sat Nov 24 09:07:01 PST 2007

A little more clarity.
I have strUserID.
With this I want to lookup up the match in array element 1 and get array
element 2 which would be the phone ext.

Thanks,
Bryan


"bryan" wrote:

> In vb, how do I do a lookup of a value in an array or table of elements.
> ie bjsorens is my userid, how do I lookup in the array to get 336 where the
> array is biult in with values of users and ext?
> Again the array or table would have a userid of 8 length and ext of 3 length
> bjsorens 336
> rewelin 415
> reellis 613
>
> If usewr is bjsorens, how do I look up in this array to get 336?
>
> Thanks,
> Bryan
>
>
> "Graham Mayor" wrote:
>
> > You haven't given enough information to do more than stab a guess at what
> > you are doing however
> >
> > Dim sExtension As String
> > sExtension = Right(UserID, 3)
> > ActiveDocument.FormFields("Text1").Result = "Ext: " & sExtension
> >
> > will put the last three characters that form the extension number of your
> > variable UserID in a text form field Text1
> >
> > --
> > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> > Graham Mayor - Word MVP
> >
> > My web site www.gmayor.com
> > Word MVP web site http://word.mvps.org
> > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> >
> > bryan wrote:
> > > document.new
> > > I get the userid from a module and want to populate a text field with
> > > the user's phone extension.
> > > Here's an example of user's and phone ext:
> > > bjsorens336
> > > rewelin415
> > > reellis613
> > >
> > > Thanks,
> > > Bryan
> >
> >
> >

Re: Arrays by Graham

Graham
Sun Nov 25 02:46:27 PST 2007

If your items are in an array then you can read the array as follows

Dim sExtension As String
Dim UserId As Variant
UserId = Array("bjsorens336", "rewelin415", "reellis613")
sExtension = Right(UserId(0), 3)
MsgBox sExtension

Where UserID = 0 ie bjsorens336

Checkout vba help on Array

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

bryan wrote:
> A little more clarity.
> I have strUserID.
> With this I want to lookup up the match in array element 1 and get
> array element 2 which would be the phone ext.
>
> Thanks,
> Bryan
>
>
> "bryan" wrote:
>
>> In vb, how do I do a lookup of a value in an array or table of
>> elements.
>> ie bjsorens is my userid, how do I lookup in the array to get 336
>> where the array is biult in with values of users and ext?
>> Again the array or table would have a userid of 8 length and ext of
>> 3 length bjsorens 336
>> rewelin 415
>> reellis 613
>>
>> If usewr is bjsorens, how do I look up in this array to get 336?
>>
>> Thanks,
>> Bryan
>>
>>
>> "Graham Mayor" wrote:
>>
>>> You haven't given enough information to do more than stab a guess
>>> at what you are doing however
>>>
>>> Dim sExtension As String
>>> sExtension = Right(UserID, 3)
>>> ActiveDocument.FormFields("Text1").Result = "Ext: " & sExtension
>>>
>>> will put the last three characters that form the extension number
>>> of your variable UserID in a text form field Text1
>>>
>>> --
>>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>> Graham Mayor - Word MVP
>>>
>>> My web site www.gmayor.com
>>> Word MVP web site http://word.mvps.org
>>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>>
>>> bryan wrote:
>>>> document.new
>>>> I get the userid from a module and want to populate a text field
>>>> with the user's phone extension.
>>>> Here's an example of user's and phone ext:
>>>> bjsorens336
>>>> rewelin415
>>>> reellis613
>>>>
>>>> Thanks,
>>>> Bryan



Re: Arrays by bryan

bryan
Sun Nov 25 06:52:01 PST 2007

I am using this:
Dim USERID
Dim iarray(4)
Dim ares
Dim smd
Dim ext
USERID = GetUserName

'Test array
iarray(0) = "bjsorens336"
iarray(1) = "rewelin112"
iarray(2) = "chadman223"
iarray(3) = "alyssa334"

ares = Filter(iarray, USERID, True, vbTextCompare)

Dim i
For i = 0 To UBound(ares)
smd = ares(i)
Next
ext = Right(smd, 3)



"Graham Mayor" wrote:

> If your items are in an array then you can read the array as follows
>
> Dim sExtension As String
> Dim UserId As Variant
> UserId = Array("bjsorens336", "rewelin415", "reellis613")
> sExtension = Right(UserId(0), 3)
> MsgBox sExtension
>
> Where UserID = 0 ie bjsorens336
>
> Checkout vba help on Array
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com
> Word MVP web site http://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
> bryan wrote:
> > A little more clarity.
> > I have strUserID.
> > With this I want to lookup up the match in array element 1 and get
> > array element 2 which would be the phone ext.
> >
> > Thanks,
> > Bryan
> >
> >
> > "bryan" wrote:
> >
> >> In vb, how do I do a lookup of a value in an array or table of
> >> elements.
> >> ie bjsorens is my userid, how do I lookup in the array to get 336
> >> where the array is biult in with values of users and ext?
> >> Again the array or table would have a userid of 8 length and ext of
> >> 3 length bjsorens 336
> >> rewelin 415
> >> reellis 613
> >>
> >> If usewr is bjsorens, how do I look up in this array to get 336?
> >>
> >> Thanks,
> >> Bryan
> >>
> >>
> >> "Graham Mayor" wrote:
> >>
> >>> You haven't given enough information to do more than stab a guess
> >>> at what you are doing however
> >>>
> >>> Dim sExtension As String
> >>> sExtension = Right(UserID, 3)
> >>> ActiveDocument.FormFields("Text1").Result = "Ext: " & sExtension
> >>>
> >>> will put the last three characters that form the extension number
> >>> of your variable UserID in a text form field Text1
> >>>
> >>> --
> >>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> >>> Graham Mayor - Word MVP
> >>>
> >>> My web site www.gmayor.com
> >>> Word MVP web site http://word.mvps.org
> >>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> >>>
> >>> bryan wrote:
> >>>> document.new
> >>>> I get the userid from a module and want to populate a text field
> >>>> with the user's phone extension.
> >>>> Here's an example of user's and phone ext:
> >>>> bjsorens336
> >>>> rewelin415
> >>>> reellis613
> >>>>
> >>>> Thanks,
> >>>> Bryan
>
>
>