N
noone
Below is the problem area of the code, I am getting a "method not supported"
error.
Set SafeItem = CreateObject("Redemption.SafeMailItem")
Set myForward = oExp.Selection.Item(1).Forward
SafeItem.Item = myForward
With SafeItem
.Recipients.Add "(e-mail address removed)"
.Body
.Send
End With
This is the entire code (minus the version functions, registry stuff, etc.)
I cannot seem to get SendKeys working since I converted this over to
a COM object instead of a VBA macro.
Am I DIMming something wrong ? Or forgetting something ?
Go easy on me, I'm new to Outlook/VBA/COM stuff.
Dim objApp As Application
Dim objSelection As Selection
Dim objExplorer As Object
Dim objItem As Object
'requires Microsoft DAO 3.6 Object Library reference
Dim db As Database 'database
Dim strSQL As String 'database
Dim strDomain, strEmail As String 'database
Dim sKey As String
Dim sValue As String
Dim vSetting As Variant
Dim vOrigSetting As Variant
Dim sType As Long
Dim pid_ver As String
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Process these email(s) as SPAM ?"
Style = vbYesNo + vbCritical + vbDefaultButton2
Title = "Anti-Spam"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
Set db = DBEngine.Workspaces(0).OpenDatabase("X:\Installs\Outlook
Anti-Spam\config.mdb") 'database
If Len("C:\Program Files\Microsoft Office\Office\outlook.exe") Then
pid_ver = fGetProductVersion("C:\Program Files\Microsoft
Office\Office\outlook.exe")
If Left(pid_ver, 1) = "9" Then
sKey =
"Software\Microsoft\Office\9.0\Outlook\Options\Spelling"
sValue = "Check"
End If
End If
If Len("C:\Program Files\Microsoft Office\Office10\outlook.exe")
Then
pid_ver = fGetProductVersion("C:\Program Files\Microsoft
Office\Office10\outlook.exe")
If Left(pid_ver, 1) = "1" Then
sKey =
"Software\Microsoft\Office\10.0\Outlook\Options\Spelling"
sValue = "Check"
End If
End If
vSetting = QueryValue(HKEY_CURRENT_USER, sKey, sValue)
vOrigSetting = QueryValue(HKEY_CURRENT_USER, sKey, sValue)
If vSetting = 1 Then
If Left(pid_ver, 1) = "9" Then
SendKeys "%TO"
SendKeys
"{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}"
SendKeys "{RIGHT}{RIGHT}{RIGHT}"
SendKeys "{TAB}{TAB}"
SendKeys " "
SendKeys "{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}"
SendKeys "{ENTER}"
End If
If Left(pid_ver, 1) = "1" Then
SendKeys "%TO"
SendKeys
"{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}"
SendKeys "{RIGHT}{RIGHT}{RIGHT}"
SendKeys "{TAB}{TAB}"
SendKeys " "
SendKeys "{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}"
SendKeys "{ENTER}"
End If
End If
Dim oExp As Outlook.Explorer
Set oExp = Outlook.ActiveExplorer
Set objSelection = oExp.Selection
Select Case objSelection.Count
Case 0
Case Is > 1
For Each objItem In objSelection
If TypeOf objItem Is MailItem Then
strEmail = R_GetSenderAddress(objItem) 'database
strDomain = sDomain(strEmail)
strSQL = "INSERT INTO antispam2_blacklist
(entry,type) VALUES ('" & strEmail & "','1')" 'database
db.Execute strSQL 'database
End If
Next
Case Is <= 1
For Each objItem In objSelection
If TypeOf objItem Is MailItem Then
strEmail = R_GetSenderAddress(objItem) 'database
strDomain = sDomain(strEmail)
strSQL = "INSERT INTO antispam2_blacklist
(entry,type) VALUES ('" & strEmail & "','1')" 'database
db.Execute strSQL 'database
Set SafeItem =
CreateObject("Redemption.SafeMailItem")
Set myForward =
oExp.Selection.Item(1).Forward
SafeItem.Item = myForward
With SafeItem
.Recipients.Add "(e-mail address removed)"
.Body
.Send
End With
End If
Next
End Select
If vOrigSetting = 1 Then
If Left(pid_ver, 1) = "9" Then
SendKeys "%TO"
SendKeys
"{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}"
SendKeys "{RIGHT}{RIGHT}{RIGHT}"
SendKeys "{TAB}{TAB}"
SendKeys " "
SendKeys "{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}"
SendKeys "{ENTER}"
End If
If Left(pid_ver, 1) = "1" Then
SendKeys "%TO"
SendKeys
"{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}"
SendKeys "{RIGHT}{RIGHT}{RIGHT}"
SendKeys "{TAB}{TAB}"
SendKeys " "
SendKeys "{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}"
SendKeys "{ENTER}"
End If
End If
db.Close 'database
End If 'msgbox
Set objApp = Nothing
Set objSelection = Nothing
Set objItem = Nothing
Thanks everyone =)
error.
Set SafeItem = CreateObject("Redemption.SafeMailItem")
Set myForward = oExp.Selection.Item(1).Forward
SafeItem.Item = myForward
With SafeItem
.Recipients.Add "(e-mail address removed)"
.Body
.Send
End With
This is the entire code (minus the version functions, registry stuff, etc.)
I cannot seem to get SendKeys working since I converted this over to
a COM object instead of a VBA macro.
Am I DIMming something wrong ? Or forgetting something ?
Go easy on me, I'm new to Outlook/VBA/COM stuff.
Dim objApp As Application
Dim objSelection As Selection
Dim objExplorer As Object
Dim objItem As Object
'requires Microsoft DAO 3.6 Object Library reference
Dim db As Database 'database
Dim strSQL As String 'database
Dim strDomain, strEmail As String 'database
Dim sKey As String
Dim sValue As String
Dim vSetting As Variant
Dim vOrigSetting As Variant
Dim sType As Long
Dim pid_ver As String
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Process these email(s) as SPAM ?"
Style = vbYesNo + vbCritical + vbDefaultButton2
Title = "Anti-Spam"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
Set db = DBEngine.Workspaces(0).OpenDatabase("X:\Installs\Outlook
Anti-Spam\config.mdb") 'database
If Len("C:\Program Files\Microsoft Office\Office\outlook.exe") Then
pid_ver = fGetProductVersion("C:\Program Files\Microsoft
Office\Office\outlook.exe")
If Left(pid_ver, 1) = "9" Then
sKey =
"Software\Microsoft\Office\9.0\Outlook\Options\Spelling"
sValue = "Check"
End If
End If
If Len("C:\Program Files\Microsoft Office\Office10\outlook.exe")
Then
pid_ver = fGetProductVersion("C:\Program Files\Microsoft
Office\Office10\outlook.exe")
If Left(pid_ver, 1) = "1" Then
sKey =
"Software\Microsoft\Office\10.0\Outlook\Options\Spelling"
sValue = "Check"
End If
End If
vSetting = QueryValue(HKEY_CURRENT_USER, sKey, sValue)
vOrigSetting = QueryValue(HKEY_CURRENT_USER, sKey, sValue)
If vSetting = 1 Then
If Left(pid_ver, 1) = "9" Then
SendKeys "%TO"
SendKeys
"{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}"
SendKeys "{RIGHT}{RIGHT}{RIGHT}"
SendKeys "{TAB}{TAB}"
SendKeys " "
SendKeys "{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}"
SendKeys "{ENTER}"
End If
If Left(pid_ver, 1) = "1" Then
SendKeys "%TO"
SendKeys
"{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}"
SendKeys "{RIGHT}{RIGHT}{RIGHT}"
SendKeys "{TAB}{TAB}"
SendKeys " "
SendKeys "{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}"
SendKeys "{ENTER}"
End If
End If
Dim oExp As Outlook.Explorer
Set oExp = Outlook.ActiveExplorer
Set objSelection = oExp.Selection
Select Case objSelection.Count
Case 0
Case Is > 1
For Each objItem In objSelection
If TypeOf objItem Is MailItem Then
strEmail = R_GetSenderAddress(objItem) 'database
strDomain = sDomain(strEmail)
strSQL = "INSERT INTO antispam2_blacklist
(entry,type) VALUES ('" & strEmail & "','1')" 'database
db.Execute strSQL 'database
End If
Next
Case Is <= 1
For Each objItem In objSelection
If TypeOf objItem Is MailItem Then
strEmail = R_GetSenderAddress(objItem) 'database
strDomain = sDomain(strEmail)
strSQL = "INSERT INTO antispam2_blacklist
(entry,type) VALUES ('" & strEmail & "','1')" 'database
db.Execute strSQL 'database
Set SafeItem =
CreateObject("Redemption.SafeMailItem")
Set myForward =
oExp.Selection.Item(1).Forward
SafeItem.Item = myForward
With SafeItem
.Recipients.Add "(e-mail address removed)"
.Body
.Send
End With
End If
Next
End Select
If vOrigSetting = 1 Then
If Left(pid_ver, 1) = "9" Then
SendKeys "%TO"
SendKeys
"{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}"
SendKeys "{RIGHT}{RIGHT}{RIGHT}"
SendKeys "{TAB}{TAB}"
SendKeys " "
SendKeys "{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}"
SendKeys "{ENTER}"
End If
If Left(pid_ver, 1) = "1" Then
SendKeys "%TO"
SendKeys
"{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}"
SendKeys "{RIGHT}{RIGHT}{RIGHT}"
SendKeys "{TAB}{TAB}"
SendKeys " "
SendKeys "{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}"
SendKeys "{ENTER}"
End If
End If
db.Close 'database
End If 'msgbox
Set objApp = Nothing
Set objSelection = Nothing
Set objItem = Nothing
Thanks everyone =)