Page 6 of 8 FirstFirst ... 45678 LastLast
Results 51 to 60 of 78

Thread: Excel COM question...

  1. #51
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Hi Mike,

    it is much simpler. If Eros will have time to develop what I need, I will make the module most probably available at GitHub.
    It is developed in PB for Windows 10.04 as of now.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  2. #52
    John,

    That looks pretty good. ;-)

    I wanted to work on that and see what I could do ... but ... I can't get Script Basic to install without error yet (even using "Run as Administrator"). Apparently, it is having problems writing to the registry. This might be due to the strict security settings at work, so I'll have to try it at home.



    Petr,

    I think anything that would enhance thinBasic is a good idea. ;-) And I would look forward to a different approach. As it is, I've been given other assignments so I'll kind of have to set aside this endeavor for now (although I may still tinker with it as I have time). I am not in a rush ... just doing a little exploration at this time.



    To further illustrate what I think I am seeing ... I'm going to compare an Excel command structure with the equivalent TB command:

    ' ---------------------------------------------------
    '  Excel:
    '  Worksheets(1).Cells(1, 1).Value = 24
    ' ---------------------------------------------------
    vParam(1) = 1   'row
    vParam(2) = 1   ' col
    vParam(3) = 24   ' cell value
    COM_SETPROPERTY(pXlSheet, "Cells", 3, vParam)
    
    In both I see the worksheet, the cell row and column and the cell value to set. What appears to be missing from the TB command is the ".Value" parameter. It seems that ".Value" is the default and I'm not seeing a way to override it (yet, anyway). So, my guess is that the COM module may have been originally created for filling the cells and not for more fancier operations. But as I said, that's just a guess. The designer might be the only person who knows for sure.



    I will be keeping my eye on this, but for now I need to take care of a few other things before I can free up enough time to hammer on it again. ;-)


    Jerry
    Last edited by Gerald Sutherland; 24-07-2014 at 21:40.

  3. #53
    Thanks for the info Petr,

    I hope I'll be able to grasp the concept though I'm not a PB user. TurboBasic was the last BZ product I laid my hands on.
    Mike
    (3.6GHz i5 Core Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, x64 Windows 7 Ultimate Sp1)

  4. #54
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Gerald,

    maybe you should retrieve reference to Range itself and then you can cast something on it - like John shows in his code.
    So instead of SetProperty you get Range first (that is how it is in the interface of Excel anyway, RANGE object returned) and then call method on it.

    I am not on PC with Excel now, so cannot try, but could work. Something like retrieving reference to Workbook/Worksheets...


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  5. #55
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Hi Mike,

    the concept, if interesting at all, would be more from thinBasic module creation stand point. As for COM, just a little magic possible with PB.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  6. #56
    As for COM, just a little magic possible with PB.
    That well is known to have run dry. You should look at alternatives to expand the functionality of TB. Just saying ...
    Last edited by John Spikowski; 24-07-2014 at 23:38.
    ScriptBasic Project Manager
    Project Site
    support@scriptbasic.org

  7. #57
    Quote Originally Posted by Jerry
    That looks pretty good. ;-)

    I wanted to work on that and see what I could do ... but ... I can't get Script Basic to install without error yet (even using "Run as Administrator"). Apparently, it is having problems writing to the registry. This might be due to the strict security settings at work, so I'll have to try it at home.
    You should probbably join the Script BASIC forum (send an e-mail to support@scriptbasic.org) where Dave would be more helpful on a real world effort with SB COM. I'm in learning mode as well.
    ScriptBasic Project Manager
    Project Site
    support@scriptbasic.org

  8. #58
    Petr,

    You're probably right. I have tried that approach and all I get is errors, so I'm definitely not doing it right. ;-) I am a relative newcomer to Excel COM and I guess I'm a bit spoiled by the fact that I could actually do something like this with PB (unfortunately, perhaps without understanding the details of HOW it works). All I need to do is get a small success or two in TB and then maybe I'll see the pattern I need to follow. :-)


    John,

    I will probably sign up this weekend. I'm just hoping to get SB installed and running before I jump in the pool. :-)


    Thanks!
    Jerry

  9. #59
    I will probably sign up this weekend. I'm just hoping to get SB installed and running before I jump in the pool. :-)
    If you need a hand either e-mail me or catch me on the #AllBASIC IRC.
    ScriptBasic Project Manager
    Project Site
    support@scriptbasic.org

  10. #60
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Hi!,

    just a little update - Eros is making impressive progress on the Excel module. He took my base and did his legendary magic again to make it even cooler:
    Uses "Excel"
    
    Function TBMain() As Long
      Dim xApp      As  Excel_Application
      Dim xWorkBook As  Excel_Workbook
      Dim xSheet    As  Excel_Worksheet
      Dim x, y      As  Long
      
      xApp = New Excel_Application
      
      MsgBox 0, "Excel version is: " + xApp.Version
      
      xApp.Visible = 1       
      
    
      '---Pass Excel Instance to create a Workbook
      xWorkBook = New Excel_WorkBook(xApp)
      
      '---Pass Workbook instance to create a sheet
      xSheet    = New Excel_Worksheet(xWorkBook)
    
      '---Write some text
      For y = 1 To 50
        For x = 1 To 5
          xSheet.Cells(y, x) = "Cell " & Chr$(x + 64) & Format$(y)
        Next
        xSheet.Cells(Y, X) = y + y / 10
      Next
      
      MsgBox 0, "OK, test done. thinBasic will now close."             
    
      'xApp.ActiveWindow.Close()
      xApp.Quit                     
    End Function
    
    You can download updated module in the attachement, stay tuned...


    Petr
    Attached Files Attached Files
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Page 6 of 8 FirstFirst ... 45678 LastLast

Similar Threads

  1. Question of the day ;)
    By Petr Schreiber in forum thinBasic General
    Replies: 8
    Last Post: 23-08-2010, 19:58
  2. gdi question
    By Lionheart008 in forum UI (User Interface)
    Replies: 6
    Last Post: 07-12-2009, 19:31
  3. Replies: 3
    Last Post: 31-03-2009, 23:16
  4. MS Excel as 3D engine :D
    By ErosOlmi in forum Development
    Replies: 3
    Last Post: 13-03-2008, 01:09
  5. Equivalent VBA Excel code
    By marcel in forum COM
    Replies: 12
    Last Post: 08-11-2007, 16:18

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •