OK, here's what I'm trying to do and can't figure out how. I've got a small
query that I'm setting to run automatically once a week. it pulls a couple
of numbers for me and stores each number in it's own memory variable. We'll
say the two memvars are mval1 and mval2. I want it to email me the results
of those memory variables. I have the query completed. I have the email
portion running but can't figure out how to get the memory variable value
into the email. All its doing is putting the memvar name into my email. My
email code is as follows and I would like to continue using this type of
emailing technique if possible:

oMSG = createobject("CDO.Message")
oMSG.To = me@mydomain.com
oMSG.From = "me@mydomain.com"
oMSG.Subject = " Weekly Numbers"
oMSG.HTMLBody = "This is the text for the body of the. the number of
visitors is &mval1 the number of those that made purchases is &mval2. "
oMSG.Send()

So, if anyone knows how to make the actual values display in place of &mval1
and &mval2 in my oMSG.HTMLBody line, that would be a great help.

Thanks!
Buster

Re: insert memory variable value into email by Bernhard

Bernhard
Mon Apr 09 11:23:09 CDT 2007

Hi Bubba,

> OK, here's what I'm trying to do and can't figure out how. I've got a small
> query that I'm setting to run automatically once a week. it pulls a couple
> of numbers for me and stores each number in it's own memory variable. We'll
> say the two memvars are mval1 and mval2. I want it to email me the results
> of those memory variables. I have the query completed. I have the email
> portion running but can't figure out how to get the memory variable value
> into the email. All its doing is putting the memvar name into my email. My
> email code is as follows and I would like to continue using this type of
> emailing technique if possible:
>
> oMSG = createobject("CDO.Message")
> oMSG.To = me@mydomain.com
> oMSG.From = "me@mydomain.com"
> oMSG.Subject = " Weekly Numbers"
> oMSG.HTMLBody = "This is the text for the body of the. the number of
> visitors is &mval1 the number of those that made purchases is &mval2. "
> oMSG.Send()
>
> So, if anyone knows how to make the actual values display in place of &mval1
> and &mval2 in my oMSG.HTMLBody line, that would be a great help.

For macro expansion, you cannot use numbers, only strings.
One way would be:
mval1=transform(mval1)
mval2=transform(mval2)
and afterwards use just your line above.

Or do it like this:
oMSG.HTMLBody ="This is the text for the body of the. the number of visitors is
" + transform(mval1) + " the number of those that made purchases is " +
transform(mval2) + ". "

Or without prior transform:
TEXT TO oMSG.HTMLBody TEXTMERGE NOSHOW
This is the text for the body of the. the number of visitors is <<mval1>>
the number of those that made purchases is <<mval2>>.
ENDTEXT

Regards
Bernhard Sander

Re: insert memory variable value into email by Bubba

Bubba
Mon Apr 09 11:59:11 CDT 2007

Worked like a champ!

Thanks Bernhard!

Buster

"Bernhard Sander" <fuchs@no.spam> wrote in message
news:%23nx2eNseHHA.4136@TK2MSFTNGP02.phx.gbl...
> Hi Bubba,
>
>> OK, here's what I'm trying to do and can't figure out how. I've got a
>> small query that I'm setting to run automatically once a week. it pulls a
>> couple of numbers for me and stores each number in it's own memory
>> variable. We'll say the two memvars are mval1 and mval2. I want it to
>> email me the results of those memory variables. I have the query
>> completed. I have the email portion running but can't figure out how to
>> get the memory variable value into the email. All its doing is putting
>> the memvar name into my email. My email code is as follows and I would
>> like to continue using this type of emailing technique if possible:
>>
>> oMSG = createobject("CDO.Message")
>> oMSG.To = me@mydomain.com
>> oMSG.From = "me@mydomain.com"
>> oMSG.Subject = " Weekly Numbers"
>> oMSG.HTMLBody = "This is the text for the body of the. the number of
>> visitors is &mval1 the number of those that made purchases is &mval2. "
>> oMSG.Send()
>>
>> So, if anyone knows how to make the actual values display in place of
>> &mval1 and &mval2 in my oMSG.HTMLBody line, that would be a great help.
>
> For macro expansion, you cannot use numbers, only strings.
> One way would be:
> mval1=transform(mval1)
> mval2=transform(mval2)
> and afterwards use just your line above.
>
> Or do it like this:
> oMSG.HTMLBody ="This is the text for the body of the. the number of
> visitors is " + transform(mval1) + " the number of those that made
> purchases is " + transform(mval2) + ". "
>
> Or without prior transform:
> TEXT TO oMSG.HTMLBody TEXTMERGE NOSHOW
> This is the text for the body of the. the number of visitors is <<mval1>>
> the number of those that made purchases is <<mval2>>.
> ENDTEXT
>
> Regards
> Bernhard Sander



Re: insert memory variable value into email (MORE) by Bubba

Bubba
Mon Apr 09 12:15:02 CDT 2007

Bernhard,

I have another question. I would actually like to format this as html and
while the html coding works, it ignores the memory variables and just
inserts the transform(memvar) code.

Can you tell me how I should format that oMSG.HTMLBody line if I want say
make a font color of "red" for the entire line of text?

Thanks again!

"Bernhard Sander" <fuchs@no.spam> wrote in message
news:%23nx2eNseHHA.4136@TK2MSFTNGP02.phx.gbl...
> Hi Bubba,
>
>> OK, here's what I'm trying to do and can't figure out how. I've got a
>> small query that I'm setting to run automatically once a week. it pulls a
>> couple of numbers for me and stores each number in it's own memory
>> variable. We'll say the two memvars are mval1 and mval2. I want it to
>> email me the results of those memory variables. I have the query
>> completed. I have the email portion running but can't figure out how to
>> get the memory variable value into the email. All its doing is putting
>> the memvar name into my email. My email code is as follows and I would
>> like to continue using this type of emailing technique if possible:
>>
>> oMSG = createobject("CDO.Message")
>> oMSG.To = me@mydomain.com
>> oMSG.From = "me@mydomain.com"
>> oMSG.Subject = " Weekly Numbers"
>> oMSG.HTMLBody = "This is the text for the body of the. the number of
>> visitors is &mval1 the number of those that made purchases is &mval2. "
>> oMSG.Send()
>>
>> So, if anyone knows how to make the actual values display in place of
>> &mval1 and &mval2 in my oMSG.HTMLBody line, that would be a great help.
>
> For macro expansion, you cannot use numbers, only strings.
> One way would be:
> mval1=transform(mval1)
> mval2=transform(mval2)
> and afterwards use just your line above.
>
> Or do it like this:
> oMSG.HTMLBody ="This is the text for the body of the. the number of
> visitors is " + transform(mval1) + " the number of those that made
> purchases is " + transform(mval2) + ". "
>
> Or without prior transform:
> TEXT TO oMSG.HTMLBody TEXTMERGE NOSHOW
> This is the text for the body of the. the number of visitors is <<mval1>>
> the number of those that made purchases is <<mval2>>.
> ENDTEXT
>
> Regards
> Bernhard Sander



Re: insert memory variable value into email (MORE) by Olaf

Olaf
Mon Apr 09 13:42:44 CDT 2007

> I have another question. I would actually like to format this as html and
> while the html coding works, it ignores the memory variables and just
> inserts the transform(memvar) code.

Then you did something wrong. Bernhard assumed your vars are
numeric, then you would use transform(mval1), but not inside of the
string. Watch closely what Bernhard did in his solution.

"text... &mval1 ...more text"
=>
"text..." + transform(mval1) + "... more text"

he separated it it into two substrings, inserting a third
string, which is the result of the transform call.

There is nothing special, if you add html tags, eg to make that
figure bold:

"text...<b>" + transform(mval1) + "</b>... more text"

Bye, Olaf.

Re: insert memory variable value into email (MORE) by Bernhard

Bernhard
Tue Apr 10 03:45:31 CDT 2007

Hi Bubba,

> I have another question. I would actually like to format this as html and
> while the html coding works, it ignores the memory variables and just
> inserts the transform(memvar) code.
>
> Can you tell me how I should format that oMSG.HTMLBody line if I want say
> make a font color of "red" for the entire line of text?

For HTML I would take the TEXT ... ENDTEXT method. Then it is quite easy to
write HTML within foxpro :-) Write your html code like you would do it in your
prefered html text editor. You simply enclose the varying parts in <<..>>

TEXT TO oMSG.HTMLBody TEXTMERGE NOSHOW
<html>
<body>
This is the text for the body of the. <span color="red">the number of visitors
is <<mval1>>
</span> the number of those that <b>made purchases is <<mval2>></b>.
</body>
</html>
ENDTEXT


Regards
Bernhard Sander