Outlook VBA sending from shared workbook while offline

logandiana

Board Regular
Joined
Feb 21, 2017
Messages
107
I created a macro in outlook vba. All it does is take drafts that are in a shared email box and sends them. Since there are a lot of emails usually, instead of trying to have the macro send the emails to the outbox, while the outbox is trying to send. What I do is put myself in the 'work offline' mode. Then I run the macro and it sends all the emails from the shared drafts folder, or rather, it moves them to the outbox. Whenever its done, I put myself back online and the emails leave the outbox as needed.

Everything works fine with the macro on my end, but my coworker has the same macro in outlook, and the same access to the same shared folder.
They can run the macro just fine and it does what it's supposed to do.
BUT if they put their selves in 'work offline' mode and then run the macro. They get a Run-time error '-2147221210 (80040126)' The operation cannot be performed because the connection to the server is offline.
The line the error is on is.

VBA Code:
Set objDrafts = Session.Folders("email.email@domain.com").Folders("Drafts").Items

Not sure why it works fine on mine whether online or offline, but only on theirs online.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,223,888
Messages
6,175,217
Members
452,619
Latest member
Shiv1198

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top