M
Michael Dawson
I have the following code which creates an email and
attaches a file.
It works fine on my machine, but when I try to run it on
another machine I get the following error message:
Run time error '458'
Variable uses an automation type not supported in Visual
Basic.
On debug it refers to this line of code :
Set olApp = New Outlook.Application
Both machines run Win 98 and Access 2000. The only
difference is mine has Outlook 2002 and the other machine
runs Outlook 2000.
Here is my code:
Dim FileName As String
Dim olApp As Outlook.Application
Dim objNewMail As Outlook.mailitem
Set olApp = New Outlook.Application
Set objNewMail = olApp.CreateItem(olMailItem)
Set fs = CreateObject("scripting.filesystemobject")
FileName = "F:\database\emailfiles\NewClientList_" & Format
(Forms!NewClientList!Text0, "ddmmyy") & ".pdf"
If WriteToIniFile("Acrobat PDFWriter", "pdffilename",
FileName, "C:\windows\system\pdfwritr.ini") Then
DoCmd.OpenReport "pdf_newclientlist"
End If
With objNewMail
..Subject = "New Client List for W/E " & Forms!
NewClientList!Text0
..Body = "Adobe Acrobat Reader is required to view this
file." & Chr(10) & Chr(12) & "If you do not have it you
can download it from
http://www.adobe.com/products/acrobat/readermain.html." &
Chr(10) & Chr(12) & Chr(10) & Chr(12)
..Attachments.Add (FileName)
..Display
End With
Am abit stuck with this, any help would be much
appreciated.
Thanks in advance
Michael Dawson
attaches a file.
It works fine on my machine, but when I try to run it on
another machine I get the following error message:
Run time error '458'
Variable uses an automation type not supported in Visual
Basic.
On debug it refers to this line of code :
Set olApp = New Outlook.Application
Both machines run Win 98 and Access 2000. The only
difference is mine has Outlook 2002 and the other machine
runs Outlook 2000.
Here is my code:
Dim FileName As String
Dim olApp As Outlook.Application
Dim objNewMail As Outlook.mailitem
Set olApp = New Outlook.Application
Set objNewMail = olApp.CreateItem(olMailItem)
Set fs = CreateObject("scripting.filesystemobject")
FileName = "F:\database\emailfiles\NewClientList_" & Format
(Forms!NewClientList!Text0, "ddmmyy") & ".pdf"
If WriteToIniFile("Acrobat PDFWriter", "pdffilename",
FileName, "C:\windows\system\pdfwritr.ini") Then
DoCmd.OpenReport "pdf_newclientlist"
End If
With objNewMail
..Subject = "New Client List for W/E " & Forms!
NewClientList!Text0
..Body = "Adobe Acrobat Reader is required to view this
file." & Chr(10) & Chr(12) & "If you do not have it you
can download it from
http://www.adobe.com/products/acrobat/readermain.html." &
Chr(10) & Chr(12) & Chr(10) & Chr(12)
..Attachments.Add (FileName)
..Display
End With
Am abit stuck with this, any help would be much
appreciated.
Thanks in advance
Michael Dawson