Zdravím, snažím sa o niečo nasledovné:
mám v outlooku nastavené 2 účty. Jeden s emailovou adresou
a@b.eu a druhý s adresou
a@c.eu Ide mi o to, že keď mi príde email na adresu
a@b.eu a ja dám replay/forward automaticky sa na odoslanie použije správny účet a teda ten s adresou
a@b.eu Ak mi príde email na druhú uvedenú adresu tak správanie je analogické..
Našiel som na nete nejaký script, ktorý by to mal v dobe odosielania kontrolovať, ALE bohužial mi to nefunguje. Novú správu neodošle vôbec a pokiaľ odpovedám tak sa mi to pošle len z účtu Aa ešte to skončí chybou:
Runtime error 424
Object required
a keď dám debug, tak mi to označí riadok
Set ofcBtn = olkSendThroughBtn.Controls(EXT_ACCOUNT)
a definícia je "Identifier under cursor is not recognized"
Ďakujem každej dobrej duši za radu
Kód:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
'On the next line edit the name of your domain. Enter it in lowercase.'
Const MY_DOMAIN = "@domenaA.eu"
'On the next line enter the ordinal number of the domenaA account as it appears in the lsit of accounts.'
Const INT_ACCOUNT = 1
'On the next line enter the ordinal number of the domenaB account as it appears in the lsit of accounts.'
Const EXT_ACCOUNT = 2
Dim olkRcp As Outlook.Recipient, intExternal As Integer, intInternal As Integer, ofcPopup As Object, ofcBtn As Object
If Item.Class = olMail Then
Set ofcPopup = Application.ActiveInspector.CommandBars("Standard").Controls(3)
For Each olkRcp In Item.Recipients
If InStr(1, LCase(olkRcp.Address), MY_DOMAIN) Then
Set ofcBtn = olkSendThroughBtn.Controls(INT_ACCOUNT)
ofcBtn.Execute
Else
Set ofcBtn = olkSendThroughBtn.Controls(EXT_ACCOUNT)
ofcBtn.Execute
End If
Next
End If
Set olkRcp = Nothing
End Sub