View Single Post
  #5  
Old March 21st 06, 09:07 PM posted to microsoft.public.outlook,microsoft.public.outlook.program_vba
windandwaves
external usenet poster
 
Posts: 18
Default installing VB script

Sue Mosher [MVP-Outlook] wrote:
This newsgroup covers VBScript applications of Outlook programming
techniques, as well as VBA. Basically, all you need to do is:

-- remove the data typing from variable and procedure declarations
-- declare any Outlook constants or use the literal values
-- instantiate an Outlook.Application object with CreateObject()


"windandwaves" wrote in message
...
Sue Mosher [MVP-Outlook] wrote:
There is no programmatic way to install VBA code. Maybe you should
be building them a COM addin instead? Or take out the variable data
typing so you can redo it as a VBSCript .vbs file.


What would you recommend. I checked out Com Addin and I need all
sorts of software for that I believe. VBscript may be a better
option. Do you know any good places where I can find help for this.

Thanks again.

Nicolaas



Here is the VB script that I created, it works a treat in XP. Any further
comments greatly appreciated.

Dim theApp
Set theApp = WScript.CreateObject("Outlook.Application")
CreateHTMLMail(theApp)
Public Sub CreateHTMLMail(olapp)
'Creates a new e-mail item and modifies its properties.
'Dim olApp As Outlook.Application
Dim objMail 'As Outlook.MailItem
'Set olApp = Outlook.Application
'Create e-mail item
Set objMail = olApp.CreateItem(olMailItem)
With objMail
'Set body format to HTML
..BodyFormat = 2' olFormatHTML
..HTMLBody = gettemplate("")
..Display
End With
End Sub


Private Function gettemplate(PathandFile)
Dim Fs
Dim A
Dim Readfile 'As String
'-
if PathandFile "" then
Set Fs = CreateObject("Scripting.FileSystemObject")
Set A = Fs.OpenTextFile(PathandFile)
'read rest of the file
Do While A.AtEndOfStream True
Readfile = Readfile & Trim(A.ReadLine)
Loop
A.Close
'-check last line
else
readfile = "htmlheadtitletest/titlebody style=" & chr(34) & "
background-color: red;" & chr(34)& "off you go/bodyhtml"
end if
gettemplate = Readfile
End Function


Is there a way to have an html document embedded in this document without
having to be so clumsy with all the " & chr(34)& "??? I would love to have
a way to include a text-block in the script.

TIA

Nicolaas



Ads