1

I've got an Excel workbook that is running some VBA code, which I use every day. During execution, it keeps hanging on a dialog box saying "Microsoft Excel is waiting for another application to complete an OLE action". Clicking "OK" lets the code continue, but often the dialog reappears after a few seconds, and keeps doing this for anywhere from 15 minutes to 2 hours (when I gave up). At the time the dialog box appears, the code is connecting to a remote computer using WMI and running a query:

If xlSheet.Cells(intRow, xlSheet.Range("Ping").Column).Value = "Yes" Then On Error Resume Next Set objWMI = GetObject("winmgmts:\\" & xlSheet.Cells(intRow, xlSheet.Range("Name").Column).Value & "\root\cimv2") If Err.Number = 0 Then Set colWin32OperatingSystem = objWMI.ExecQuery("SELECT Version, ServicePackMajorVersion, ServicePackMinorVersion FROM Win32_OperatingSystem")

It seems to be the same computer (row) that hangs every time, so my current theory is that it's having trouble connecting to WMI on the computer in question, and instead of just timing out and continuing, it's getting stuck. I've got checks along the way set to skip the current computer if any test fails. It tries to resolve the DNS name, then tries to ping, then tries to connect via WMI, and then runs the query.

I've searched around for an answer without success. I'm not entirely familiar with OLE, other than knowing (for Excel) it is a way of putting non-spreadsheet content into the spreadsheet. But I wouldn't have thought that that had anything to do with running WMI queries through VBA? Can anyone give me a push in the right direction?

1
  • Perhaps providing the entirety of your code will help in debugging. Aug 13, 2015 at 8:46

0

You must log in to answer this question.

Browse other questions tagged .