User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Legacy and Other Languages section within the Software Development category of DaniWeb, a massive community of 374,571 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,550 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Legacy and Other Languages advertiser:
Jan 6th, 2005
Views: 4,949
Another look at BCX basic. Here we use COM support to manipulate Excel. In other words, from within the basic code we are entering a few numbers into the Excel spreadsheet and add them up. Of course you can do much more powerful stuff. With COM support you can also access Word and the Internet Explorer from your basic program.
qbasic Syntax | 3 stars
  1. ' do some basic data manipulations with EXCEL using COM
  2. ' (you have to have the EXCEL program installed on your computer)
  3. ' needs BCX basic ver 5.05.05 or later, download package from:
  4. ' http://www.rjpcomputing.com/programming/bcx/devsuite.html
  5. ' COM credit goes to: Ljubisa Knezevic
  6.  
  7. BCX_SHOW_COM_ERRORS(TRUE)
  8.  
  9. DIM app AS Object
  10. set app = CreateObject("Excel.Application")
  11.  
  12. app.workbooks.add
  13. app.visible = true
  14. app.ActiveSheet.Cells(1,1).Value = "BCX does Excel ..."
  15. app.ActiveSheet.Cells(3,1).Value = 12.3
  16. app.ActiveSheet.Cells(4,1).Value = 7.4
  17. app.ActiveSheet.Cells(5,1).Value = "-----------"
  18. app.ActiveSheet.Cells(6,1).Value = "=sum(a3:a4)" ' sum it up
  19.  
  20. msgbox "Press OK to close Excel"
  21. ' close down Excel
  22. SLEEP(100)
  23. app.activeworkbook.saved = true ' fake it
  24. app.quit
  25. set app = Nothing
  26.  
Post Comment

Only community members can submit or comment on code snippets. You must register or log in to contribute.

DaniWeb Marketplace (Sponsored Links)
All times are GMT -4. The time now is 5:44 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC