Share via

Need to create multiple VBA macros for automatic emails in different languages

Anonymous
2024-04-26T22:34:24+00:00

I have a ESL class that speak many different languages.

I have created a VBA code that allows me to send an email with the click of a button in there primary language (Spanish) that lets student know they missed a class and ask if they need help.

Now I want to create the same code in different languages on the same excel sheet with different send email buttons.

Is this possible?

I need on for Spanish, Portuguese, Mandarin, Persian (Farsi)

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2024-04-26T23:31:16+00:00

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

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful