Hi,
I have these codes in outlook for template selection but giving me this error in:
Case 0, Case 1, and Case 3, this is the error: (I checked names for misspelling and are correct)
Run-Time error '-2147287038 (30030002)':
we can't open
c:\users\....................
Form Code:
Macro code to run Templates:
thank you
I have these codes in outlook for template selection but giving me this error in:
Case 0, Case 1, and Case 3, this is the error: (I checked names for misspelling and are correct)
Run-Time error '-2147287038 (30030002)':
we can't open
c:\users\....................
Form Code:
VBA Code:
Option Explicit
Private Sub UserForm_Initialize()
With Combobox1
.AddItem "NCL-PRIMUS USD WIRE(S) FOR THE WEEK OF_BATCH"
.AddItem "NCL-PRIMUS CAD WIRE(S) FOR THE WEEK OF_BATCH"
.AddItem "NCL-PRIMUS EFT FOR THE WEEK OF_BATCH"
.AddItem "NCL-PRIMUS ONLINE PAYMENTS FOR THE WEEK OF_BATCH"
.AddItem "BANKING INFORMATION REQUEST"
.AddItem "BC HYDRO EFT REMITTANCE"
End With
End Sub
Private Sub btnOK_Click()
lstNum = Combobox1.ListIndex
'With Me.Combobox1
'MsgBox "Index number = " & lstNum & "; Value = " & .Value
'End With
Unload Me
End Sub
Macro code to run Templates:
VBA Code:
Option Explicit
Public lstNum As Integer
Public Sub ChooseTemplate()
Dim oMail As Outlook.MailItem
Dim strTemplate As String
UserForm1.Show
Select Case lstNum
Case -1
' -1 is what you want to use if nothing is selected
strTemplate = "NCL-PRIMUS USD WIRE(S) FOR THE WEEK OF_BATCH"
Case 0
strTemplate = "NCL-PRIMUS USD WIRE(S) FOR THE WEEK OF_BATCH"
Case 1
strTemplate = "NCL-PRIMUS CAD WIRE(S) FOR THE WEEK OF_BATCH"
Case 2
strTemplate = "NCL-PRIMUS EFT FOR THE WEEK OF_BATCH"
Case 3
strTemplate = "NCL-PRIMUS ONLINE PAYMENTS FOR THE WEEK OF_BATCH"
Case 4
strTemplate = "BANKING INFORMATION REQUEST"
Case 5
strTemplate = "BC HYDRO EFT REMITTANCE"
End Select
strTemplate = "C:\Users\jose.rossi\AppData\Roaming\Microsoft\Templates\" & strTemplate & ".oft"
Set oMail = Application.CreateItemFromTemplate(strTemplate)
oMail.Display
Set oMail = Nothing
Set oMail = Nothing
End Sub
thank you