home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 21 / CTROM21B.mdf / win95 / utility / wb99g32i / exceldde.wb_ < prev    next >
Text File  |  1998-10-29  |  1KB  |  62 lines

  1.  
  2. ;Excel DDE Example
  3. ;This code makes a multiplication table in Excel via DDE
  4.                                                  
  5.          key="SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\EXCEL.EXE"
  6.          flag=RegExistKey(@REGMACHINE,key)
  7.          Terminate(flag==0,"Error","Excel not registered on this machine")
  8.          b = RegQueryValue(@REGMACHINE,key)   ; Default value
  9.  
  10.          run(b,"")                                       ; Run Excel
  11.  
  12.          channel = DDEInitiate("Excel", "Sheet1")
  13.  
  14.          Numbers="One Two Three Four Five Six Seven Eight Nine Ten"
  15.  
  16.          offset=1
  17.          row=0
  18.  
  19.          :rowloop
  20.          col=0
  21.          row=row+1
  22.          if row > 10 then goto byebye
  23.  
  24.          ThisNum=ItemExtract(row,Numbers," ")
  25.          title=row+offset
  26.          DDEPoke(channel, "R1C%title%", ThisNum)
  27.          DDEPoke(channel, "R%title%C1", ThisNUm)
  28.  
  29.          :colloop
  30.          col=col+1
  31.          if col > 10 then goto rowloop
  32.  
  33.          expression="=%row%*%col%"
  34.          address=strcat("R",row+offset,"C",col+offset)
  35.          DDEPoke(channel,address,expression)
  36.          goto colloop
  37.  
  38.          :byebye
  39.          DDETerminate(channel)
  40.          Message("WinBatch DDE Sample","Complete")
  41.          
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.