DDETimeout (statement)

Syntax DDETimeout milliseconds
Description Sets the number of milliseconds that must elapse before any DDE command times out.
Comments The milliseconds parameter is a Long and must be within the following range:  0 <= milliseconds <= 2,147,483,647 The default is 10,000 (10 seconds).
Example This example sets and retrieves a cell in an Excel spreadsheet. The timeout has been set to wait 2 seconds for Excel to respond before timing out.
Sub Main()
  Dim cmd,q,ch%
  q = Chr(34) ' Define quotation marks.
  id = Shell("c:\excel5\excel.exe",3) 'Start Excel.
  ch% = DDEInitiate("Excel","Sheet1")
  DDETimeout 2000  'Wait 2 seconds for Excel to respond
  On Error Resume Next
  cmd = "[ACTIVATE(" & q &"SHEET1" & q & ")]" 'Activate worksheet.
  DDEExecute ch%,cmd
  DDEPoke ch%,"R1C1","$1000.00"   'Send value to cell.
  'Retrieve value and display.
  MsgBox "The value of Row 1, Cell 1 is: " & DDERequest(ch%,"R1C1")
  DDETerminate ch%
  Msgbox "Finished   "
End Sub
See Also DDEExecute (statement); DDEInitiate (function); DDEPoke (statement); DDERequest, DDERequest$ (functions); DDESend (function); DDETerminate (statement); DDETerminateAll (statement).