1. You need to use Redemption and VBA to do it.
2. Are you adding the accounts as POP or IMAP? The mail will sync daily - you can backup up pst files easily, but IMAP needs exported or copied out using vba.
Hi Diane,
Thank you for your help.
I searched the question "can vba setup email account in outlook?" serveral time on Microsoft ChatGPT yesterday.
ChatGPT gave me two different answer below:
1.Yes, VBA (Visual Basic for Applications) can be used to automate the process of setting up an email account in Outlook. Here is a sample code that you can use to create an Outlook email account programmatically using VBA:
2.I'm sorry, but VBA cannot set up an email account in Outlook. This task requires administrative privileges and cannot be done through VBA code. To set up an email account in Outlook, you need to manually configure the account settings by providing the email address, incoming and outgoing server information, username, and password. However, you can use VBA to automate the process of sending an email using an existing email account in Outlook. Here's an example of how to create and send an email in Outlook using VBA:
ChatGPT provide me 5 sample codes, 5 key code lines below:
Set olAccount = olNs.Accounts.Add(strEmail, "POP3")
Set olAccount = olNs.AddAccount(strEmail, "IMAP")
Set olAccount = olAccounts.Add(
your@email.com, "EXCHANGE", "your password")
Set objAccount = objOL.Session.Accounts.Add("Email Address", "Display Name", "Incoming Mail Server", "Outgoing Mail Server", "Username", "Password")
but these 5 code line can not be run in VBE, the same error:"The object don't support this attribute or methord"
it makes me confused, these 5 code lines that Microsoft provide need third party Library?
Regards.