A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hello,
Yes, it's definitely possible to create multiple VBA macros for sending automatic emails in different languages from an Excel sheet. You can create separate buttons for each language, and assign a macro to each that includes the email template in the respective language.
Write the email template for each language you need: Spanish, Portuguese, Mandarin, and Persian
Add buttons to your Excel sheet for each language.
Duplicate your existing VBA code for each button. Modify the email body text within the code to match the respective language template. Assign Macros to Buttons: Assign the corresponding macro to each button.
Sub SendEmailSpanish() Dim emailBody As String emailBody = "Your Spanish text goes here" ' Your code to send the email End Sub
Sub SendEmailPortuguese() Dim emailBody As String emailBody = "Your Portuguese text goes here" ' Your code to send the email End Sub
' Repeat for Mandarin and Persian
You would replace "Your Spanish text goes here" and "Your Portuguese text goes here" with the actual content of your email templates in the respective languages.
To keep the code clean, you can consider using a function to send emails where you pass the email body text as a parameter instead of having the sending code duplicated in each macro. This way, you maintain the code in one place, which makes updates and troubleshooting easier.
Hope this helps!
Warm Regards, Ozi