Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / December 2006

Tip: Looking for answers? Try searching our database.

Variable of a variable

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sol Apache - 12 Dec 2006 01:36 GMT
In most user forms I create the sender¹s email address using the firstname$
+ ³.² + lastname$ (field1.value, field2.value) then adding whatever the
company email address is as text + ³@smallCo.com².

With the userform I am doing at the moment there are three different email
addresses, depending upon what address the user chooses to put in the
letterhead which has the company¹s main email address - info@smallco1.com -
(or smallco2.com...) placed at the h2 bookmark.

Is there a way of storing the value I want to add to the sender¹s personal
email address so I can call it without the user having to fill in something
on the form? I have in mind to change the code with the required value,
perhaps something like this:

If List$ = ³CoName1² then
FrmUsr1.var1
EmailEnd$ = ³@smallCo1.com²
End if

How do I code this so it can become a EmailEnd$ And how do I set the
variable at the start of the macro? I cannot test my code because I have not
a clue as to what I can put at the declaration part of the macro.

Thanks for any help
Jean-Guy Marcil - 12 Dec 2006 02:07 GMT
Sol Apache was telling us:
Sol Apache nous racontait que :

> In most user forms I create the sender¹s email address using the
> firstname$ + ³.² + lastname$ (field1.value, field2.value) then adding
[quoted text clipped - 19 lines]
> have not a clue as to what I can put at the declaration part of the
> macro.

At its simplest, you could try:

   Dim strEmailEnd As String

   With ActiveDocument.Bookmarks("h2").Range
       strEmailEnd = Mid(.Text, 5, 13)
   End With

Depending on the actual content of the bookmark, you will probably need to
parse the bookmarked text in a different manner

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

Sol Apache - 12 Dec 2006 22:18 GMT
Jean-Guy, thanks for the suggestion. I have at last thought of a workaround
and that is to create an invisible textbox called ³TexEmailEnd² and when I
initialize my two combo boxes mentioned in earlier emails I have added this
line:

TexEmailEnd.Text = ³smalco2.com²

Amazingly this works! The value gets added to my email$ and placed at the
appropriate bookmark.

Thx

Sol

(Still nowhere near becoming an MVP in Visual Basic...)

On 12/12/06 02:07, in article eb86UJZHHHA.4068@TK2MSFTNGP03.phx.gbl,

> Sol Apache was telling us:
> Sol Apache nous racontait que :
[quoted text clipped - 33 lines]
> Depending on the actual content of the bookmark, you will probably need to
> parse the bookmarked text in a different manner
Jean-Guy Marcil - 15 Dec 2006 16:02 GMT
Sol Apache was telling us:
Sol Apache nous racontait que :

> Jean-Guy, thanks for the suggestion. I have at last thought of a
> workaround and that is to create an invisible textbox called
[quoted text clipped - 5 lines]
> Amazingly this works! The value gets added to my email$ and placed at
> the appropriate bookmark.

I do not understand why you need an invisible textbox to store a value when
you could simply use a constant in the code....

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

Sol Apache - 17 Dec 2006 11:25 GMT
Hi Jean-Guy
The reason was because I could not work out how to put your suggestion into
my code.

Sol

On 15/12/06 16:02, in article OgMJjJGIHHA.1008@TK2MSFTNGP06.phx.gbl,

> Sol Apache was telling us:
> Sol Apache nous racontait que :
[quoted text clipped - 11 lines]
> I do not understand why you need an invisible textbox to store a value when
> you could simply use a constant in the code....

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.