Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 97 auto email how to write VBScript in VBA

Status
Not open for further replies.

vincerhodes

Programmer
May 21, 2008
3
GB
I've set up an email function in an access database, The email is compiled by using VBA to write HTML code to Outlook 2002 using the built in Outlook commands.

Everything works fine so far, but I would like to include some simple VBScript to allow the user to select an option (in this case accept or decline the date/time specified) and email the response back...

The problem is that in VBA you have to write HTML continuously, enclosed in quotes. But VBScript uses a newline between code instructions, does anyone know if there is a newline character I can write into the vba code so I can write VBScript in this manner.

See below for an example of some HTML written in VBA.

****
Sub helloWorld()

dim OutApp as Object
dim OutMail as Object

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.createitem(0)

dim exampleVariable As String

exampleVariable = "<HTML><head><title><p>Hello world</p></title></head><body><p>Please select the option below and click 'send response'</p><p><SCRIPT LANGUAGE="VBScript">'Code Goes Here'</SCRIPT></body></HTML>"

OutMail.To = "first.last@somewhere.com"
OutMail.Subject = "Hello World!"
OutMail.HTMLBody = exampleVariable

OutMail.Display

Set OutMail = Nothing

End Sub

****

Please can someone let me know if this is even possible or what the alternative is.

Thanks,

J
 
Could you attach voting buttons as this is more standard Outlook behaviour?

See my example here

Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top