06-26-2006 05:15 AM
Hello.
I am trying to get the names of currently open Excel sheets into DIAdem to read out a particular value.
Excel offers a list of its open sheets when the app=Excel topic="System" item="topics" is requested via DDE. As in the following Word macro:
Sub test2()
'
' test2 Makro
' Makro erstellt am 22.06.2006 von MConze
Dim cmd As String
Dim chan As Long
chan = DDEInitiate(App:="Excel", Topic:="System")
topicList = DDERequest(Channel:=chan, Item:="Topics")
Selection.InsertAfter topicList
DDETerminateAll
End Sub
This will yield a result like:
[book1.xls]Tabelle1 [book1.xls]Tabelle2 [book1.xls]Tabelle3 System
However, this approach fails in DIAdem:
Calling the same DDE information with the following VBS code
call DDEClose()
call DDEOpen("Excel","System")
call DDErequesttext("Topics",1000)
call DDEclose()
msgbox DDEreqvalue
will only deliver
System
as output. This is strange, since Excel cannot really know to whom it is delivereing DDE information.
Neither is this behaviour due to not being able to show more than 1 value, as the following code will demonstrate:
call DDEClose()
call DDEOpen("Excel","System")
call DDErequesttext("SysItems",1000)
call DDEclose()
msgbox DDEreqvalue
which gives
SysItems Topics Status Formats Selection Protocols EditEnvItems
Does anyone know a workaround? Once I know my place, retrieving the value is working fine.
Thank You
Michael
06-27-2006 10:10 AM