LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Code pause when disconnecting from Terminal Services.

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble Printing from Excel in terminal services snorbens Excel Discussion (Misc queries) 0 October 9th 07 11:09 PM
Pause Code Execution Luke Bailey Excel Programming 2 June 15th 06 08:33 PM
Pause code in vb Greg[_27_] Excel Programming 4 May 9th 06 10:36 PM
VB print to Terminal Services Printer Leslie Excel Programming 0 July 25th 05 10:10 PM
Pause code for data return Candyman Excel Programming 2 January 22nd 05 01:02 AM


All times are GMT +1. The time now is 12:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"