Macro Won't run on MS Server 2012

KungFu Keyboard

New Member
Joined
Oct 22, 2016
Messages
26
Hi there,

I have a macro file that extracts emails out of excel, strips each one of its important data points and then copy pastes the data into a central file. The macro works fine from my pc, but when I try and set it up on the server, the file starts to extract emails but then hangs without any error message.

Microsoft office on both my pc and the server are 64 bit
Both Excel versions are 2013 and both have Object Library 15.0

There is a hell of a lot of code so I wont paste all of it here, but the code associated to the point at which the file hangs is the following:

Sub GetFromOutlook()

Application.DisplayAlerts = False


Dim OutlookApp As Outlook.Application
Dim OutlookNamespace As Namespace
Dim Folder As MAPIFolder
Dim OutlookRecipient As Outlook.Recipient
Dim OutlookMail As Variant
Dim I As Integer
Dim Lastrow As Long


Set OutlookApp = New Outlook.Application
Set OutlookNamespace = OutlookApp.GetNamespace("MAPI")
Set OutlookRecipient = OutlookNamespace.CreateRecipient("bi@globalloadcontrol.com")
Set Folder = OutlookNamespace.GetSharedDefaultFolder(OutlookRecipient, olFolderInbox).Folders("EY_Load Sheets")


I = 1


For Each OutlookMail In Folder.Items
If OutlookMail.ReceivedTime >= Range("From_date").Value Then
Range("eMail_subject").Offset(I, 0).Value = OutlookMail.Subject
Range("eMail_date").Offset(I, 0).Value = OutlookMail.ReceivedTime
Range("eMail_sender").Offset(I, 0).Value = OutlookMail.SenderName
Range("eMail_text").Offset(I, 0).Value = OutlookMail.Body

I = I + 1
End If
Next OutlookMail


Set Folder = Nothing
Set OutlookNamespace = Nothing
Set OutlookApp = Nothing
Set OutlookRecipient = Nothing

Anyone have any ideas about why this happens?

Regards
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,216,104
Messages
6,128,856
Members
449,472
Latest member
ebc9

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