I have tried with Excel 2003, Excel 2007 and Excel 2010 and all experience the same issue of hanging when calling the DDEInitiate function.
Many thanks in advance,
Dave
Option Explicit
Dim DDE_channel As Integer
Function StartupDDE() As Boolean
Dim blnIsRunning As Boolean
On Error GoTo Err_Handler
blnIsRunning = VensimRunningCheck
'Check to see if Channel Number has already been assigned
If Not DDE_channel > 0 Or blnIsRunning = False Then
'Channel not assigned - check to see if Vensim running
If blnIsRunning = False Then
'Vensim not running - try to open
Dim RetVal
RetVal = Shell("C:\Program Files (x86)\Vensim\Vensim.exe", vbMaximizedFocus)
AppActivate "Microsoft Excel"
Excel.Application.Visible = True
End If
'Connect to Vensim
DDE_channel = Application.DDEInitiate("VENSIM", "System")
End If
StartupDDE = True
Exit Function
Err_Handler:
MsgBox "There was an error trying to connect to Vensim. Please close and reopen Vensim manually", vbExclamation
+ vbOKOnly, "Vensim Connect Error"
StartupDDE = False
End Function