user928
(User)
February 22, 2023, 9:14am
1
Hi Everyone,
I’m facing an issue with VBA code i want to send a outlook mail in encrypted format through VBA code but when i use in UiPath it is throwing an error. I’m attaching my code below.
Note: I’m not sure whether my VB script is correct or not. I have basic knowledge on VBA.
Main.xaml (7.1 KB)
MailVBA.txt (687 Bytes)
Hi @user928 , can you provide error details?
Hi @user928 ,
from your code it looks like, There is one error in the code:
oMail.BodyFormat = olFormatEncrypt
The error is that the constant olFormatEncrypt
is not defined or declared. The correct constant to use for encrypted email is olEncrypted
.
The line should be modified to:
oMail.BodyFormat = olEncrypted
After this modification, the code should work correctly.
If not works, kindly provide your error details.
user928
(User)
February 23, 2023, 2:28pm
4
Hi @ABHIMANYU_THITE1 i did that modification but still i’m getting validation error.
I have attached same code UiPath Xaml in my question. If you have time please have a look on that.
Hi @user928 ,
You can do two things either change setting of the project turn off the option strict OR make changes in the code.
turn off the option strict
Open your UiPath project in UiPath Studio.
In the Project panel, click on the gear icon to open the Project Settings.
In the Project Settings window, select the “Settings” tab.
In the “Settings” tab, scroll down until you find the “VB.Net ” section.
In the “VB.Net ” section, find the “Option Strict” setting and change it to “Off”.
Click “Save” to save your changes.
OR
Changes in the Code, below thing explain you early binding and late binding.
late binding like this:
Dim obj As Object
obj = CreateObject("SomeCOMObject")
obj.SomeMethod()
You can use early binding like this:
Dim obj As SomeCOMObject
obj = New SomeCOMObject()
obj.SomeMethod()
You have create code with Late Binding, need to change with early binding
user928
(User)
February 23, 2023, 3:09pm
6
Hi @ABHIMANYU_THITE1 , i tried i don’t know how to set it exactly. If possible can you modify my code and share. That will be a great help because i don’t know Vb scripting.
MailVBA.txt (687 Bytes)
postwick
(Paul Ostwick)
February 23, 2023, 3:11pm
7
Why don’t you just set Outlook to encrypt the emails and then use the Send Outlook Mail Message activity?
What are the options to send email with encryption using UiPath?
The activities to send Outlook emails do not offer support for encrypted content.
What can be done is to check the option "Encrypt contents .." that is available in Outlook Options / Trust Center / Email Security and let Outlook handle the encryption.
[image]
user928
(User)
February 23, 2023, 3:26pm
8
Hi @postwick There is a challenge here for me. i should not send all mails in Encrypted format only specific type of mails i need to send in Encrypted format. I don’t think so it may not be useful.
1 Like