home *** CD-ROM | disk | FTP | other *** search
-
- ;Excel DDE Example
- ;This code makes a multiplication table in Excel via DDE
-
- key="SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\EXCEL.EXE"
- flag=RegExistKey(@REGMACHINE,key)
- Terminate(flag==0,"Error","Excel not registered on this machine")
- b = RegQueryValue(@REGMACHINE,key) ; Default value
-
- run(b,"") ; Run Excel
-
- channel = DDEInitiate("Excel", "Sheet1")
-
- Numbers="One Two Three Four Five Six Seven Eight Nine Ten"
-
- offset=1
- row=0
-
- :rowloop
- col=0
- row=row+1
- if row > 10 then goto byebye
-
- ThisNum=ItemExtract(row,Numbers," ")
- title=row+offset
- DDEPoke(channel, "R1C%title%", ThisNum)
- DDEPoke(channel, "R%title%C1", ThisNUm)
-
- :colloop
- col=col+1
- if col > 10 then goto rowloop
-
- expression="=%row%*%col%"
- address=strcat("R",row+offset,"C",col+offset)
- DDEPoke(channel,address,expression)
- goto colloop
-
- :byebye
- DDETerminate(channel)
- Message("WinBatch DDE Sample","Complete")
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-