User Form change case

O

Oz Springs

I have created a User Form which includes two Text fields: FirstName and
LastName which are used as the signature$ (firstname + ³ ³ + lastname) and
for the first part of the email$ (firstname + ³.² + lastname)*

The variable works fine for the signature (Fred Nurk), but I want to change
all the text to lowercase for the email address (fred.nurk).

Where can I put the change case command (Selection.Range.Case = wdLowerCase
or the correct variation of this). Can I put it in the variable or in the
script which places the value at the bookmark do I have to create a field in
which to put the result?

If I have to create a user form field can I designate the value to be lower
case, as I could not find this in Properties. Can the field be hidden?

If I put it into the email part of the script how do I make the value become
lower case?

Apologies - my knowledge of Visual Basic is Very Basic :-(

Thanks for any help




Oz
* [NB straight quotes used, but they may not show as such in this email]
 
J

JE McGimpsey

Oz Springs said:
I have created a User Form which includes two Text fields: FirstName and
LastName which are used as the signature$ (firstname + ³ ³ + lastname) and
for the first part of the email$ (firstname + ³.² + lastname)*

The variable works fine for the signature (Fred Nurk), but I want to change
all the text to lowercase for the email address (fred.nurk).

Where can I put the change case command (Selection.Range.Case = wdLowerCase
or the correct variation of this). Can I put it in the variable or in the
script which places the value at the bookmark do I have to create a field in
which to put the result?

If I have to create a user form field can I designate the value to be lower
case, as I could not find this in Properties. Can the field be hidden?

If I put it into the email part of the script how do I make the value become
lower case?

Apologies - my knowledge of Visual Basic is Very Basic :-(

I might use something like this (assuming a button, btnInsert, used to
insert the text, and two textboxes for the names, tbFirstName and
tbLastName):

Private Sub btnInsert_Click()
Const sDOMAIN As String = "@mydomain.com"
Dim sFirst As String
Dim sLast As String
sFirst = LCase(Trim(tbFirstName.Text))
sLast = LCase(Trim(tbLastName.Text))
'Do any additional Error Checking here
Selection.Range.Text = sFirst & "." & sLast & sDOMAIN
End Sub
 
O

Oz Springs

Thank you, this is very helpful.

Are there any lists which deal with Word macro-making (VB), particularly for
the Mac? If there isn¹t any for the Mac, I¹d be happy with a general Word VB
list.


Many thanks



Oz
 
P

Paul Berkowitz

Are there any lists which deal with Word macro-making (VB), particularly for
the Mac? If there isn¹t any for the Mac, I¹d be happy with a general Word VB
list.

Newsgroups - several. Subscribe to microsoft.public.word.vba.general, which
should cover most of it. There are very good MVPs covering that NG. There's
next to no difference between Win and Mac - just remind them occasionally
that you're stuck with VBA 5.0 here.

There are few other newsgroups, as you can see by clicking on Microsoft News
Server in Entourage and browsing down among microsoft.public.word.vba
region.

I personally found the O'Reilly "Writing Word macros" book a decent
introduction, although I know the Wordies feel there are some better books
out there.

--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.
 
O

Oz Springs

Thank you for this information. I have just posted a message to the vba
beginners group which seems to be more lively than the public.word.vba
group.

Kind regards



Oz
 

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