Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Access 97 auto email how to write VBScript in VBA

Access 97 auto email how to write VBScript in VBA

Access 97 auto email how to write VBScript in VBA

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")
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


Set OutMail = Nothing

End Sub


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



RE: Access 97 auto email how to write VBScript in VBA

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

See my example here

Hope this helps

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: How to get the best answers before posting.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close