Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am running some code on a Windows XP PC using Office 2003 and I am
connecting to this PC via Remote Desktop (Terminal Services). While I am connected everything appears to be fine, but if I disconnect and leave the remote PC to run by itself I get issues. This code is in an Excel Module that processes emails from an Outlook folder, so I am not sure if this is an Excel issue or an Outlook issue, so I have posted this to both discussion groups. The problems occurs at the line €œMessageText = olMail.Body€. Initially I would get a message saying something about waiting for another OLE process, after some research I found a reference to using €œCoRegisterMessageFilter 0&, lMsgFilter€ to prevent the message being displayed, this appears to work fine. BUT if you disconnect from the remote PC when the code gets to the line in question, it just pauses without error. I have left this for 2 days and it just sits there, if you then connect back in the code resumes and the code completes without error. It took me ages to find this single line of code causing the issue and now that I have found it I have no idea what I can try next. Any ideas? Public Declare Function CoRegisterMessageFilter Lib "OLE32.DLL" (ByVal lFilterIn As Long, ByRef lPreviousFilter) As Long Public lMsgFilter As Long For ItemReference = MailCount To 1 Step -1 ' Get reference to items in folder On Error Resume Next Set olMail = InputFolder.Items(ItemReference) Application.DisplayAlerts = False CoRegisterMessageFilter 0&, lMsgFilter MessageText = olMail.Body <<<<<<< Problem occurs here Application.DisplayAlerts = True CoRegisterMessageFilter lMsgFilter, lMsgFilter |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Trouble Printing from Excel in terminal services | Excel Discussion (Misc queries) | |||
Pause Code Execution | Excel Programming | |||
Pause code in vb | Excel Programming | |||
VB print to Terminal Services Printer | Excel Programming | |||
Pause code for data return | Excel Programming |