Page 3 of 8 FirstFirst 12345 ... LastLast
Results 21 to 30 of 78

Thread: Excel COM question...

  1. #21
    Tomorrow I'll see if I can get a couple of the things I have done working in SB so that I can demonstrate where I am headed with this. Is it okay for me to post either SB or PB code here for such an illustration? (wanted to ask first).
    The SB COM ext. module need beta testing and feedback. I think everyone benefits when done in an open way. Everyone is welcome to use SB source code or embed the scripting API in open source projects or closed commercial products. I facilitate and manage the Script BASIC open source project and provide fee based commercial support and programming services.
    ScriptBasic Project Manager
    Project Site
    support@scriptbasic.org

  2. #22
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Quote Originally Posted by Gerald Sutherland View Post
    One other thing though ... wouldn't it be against PB's policy to encapsulated their functionality into something for different language (perhaps with the exception of a DLL)? I'm not clear on this subject, and as I recall, TB had some issues with this in the past. Anyway, I would interested learning how this sort of thing can be done.
    Hi Gerald,

    wrapping for example REGEX command from PowerBASIC would be violation of their policy (understandable), but wrapping usage of third party COM calls is perfectly fine.
    I would not expose their COM engine, I would expose the Excel methods and properties in VBA like way.

    Hi John,
    one would think Jose Roca would have shown some interest in making thinBasic more COM aware
    Watching the frequency of COM requests for ThinBASIC (one in multiple years), I think we have the answer to this question, don't we...


    Petr
    Last edited by Petr Schreiber; 20-07-2014 at 19:02.
    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

  3. #23
    From what I hear, Jose is very busy right now and probably doesn't have a lot of spare time anyway. :-) Besides, he has already done an incredible amount of things for the programming community.

    Petr, you have made a good point. If I am the only person who has shown any interest in the COM module, then perhaps there is no point trying bring it to the forefront at this time. However, I am definitely interested in your process of turning whatever I may come up with (PB) into a form compatible with TB. If the offer is still open, please tell me how to go about this.

    I tried to tinker with Script BASIC a bit, but didn't really get anywhere. That is what I would expect until I have more time to dig into how it works. :-)

    I'm sure I still have my copy of VB6 around here somewhere, but I'll have to install it into a virtual machine since it won't run on 64-bit Windows.

    Now getting back to comparing VBA, PB and TB:

    To set the background color of a group of cells:

    VBA:

    Range("G1:G3").Select
    With Selection.Interior
    .ColorIndex = 38
    .Pattern = xSolid
    End With

    This is a fairly straightforward translation to PB:

    Let vrange = "G1:G3"
    vtext = "38"
    OBJECT LET oExcelWorkSheet.Range(vrange).Interior.ColorIndex = vText
    vtext = "xlSolid"
    OBJECT LET oExcelWorkSheet.Range(vrange).Interior.Pattern = Text

    I just haven't caught on to how to translate the VBA to TB syntax (or SB, for that matter).

    On the other hand, I have made a little progress with TB. Now I can read the row, column and content of the active cell. Baby steps. :-)

    Thanks to everyone for their help up to this point. :-)

    Jerry

  4. #24
    Thanks Jerry for the progress report.

    I'm sure I still have my copy of VB6 around here somewhere, but I'll have to install it into a virtual machine since it won't run on 64-bit Windows.
    I'm running VB6 (Visual Studio 6) on my copy of Windows 7 64 bit without issue. In fact I'm trying to get current Windows 7 theming to work with it.

    VB6 example themed and runing on Windows 7 64 bit


    If there is any interest in Script BASIC, it would be great if you join the Script BASIC forum (send me an e-mail support@scriptbasic.org) and connect with Dave on any issues you have.
    Last edited by John Spikowski; 21-07-2014 at 00:24.
    ScriptBasic Project Manager
    Project Site
    support@scriptbasic.org

  5. #25
    Perhaps VB6 just has a 16-bit installer (not uncommon). I did find an article that claimed it could be done ... but their instructions would not work for me (I am also running Windows 7 64-bit).

    Anyway, wishing everyone goodnight.

    Jerry

  6. #26
    VB6 is a 32 bit application and will be supported (not upgraded) by Microsoft for some time. (as long as 32 bit applications are supported)


    See if the article helps.

    How to install Visual Studio 6 on Windows 7 professional 64bit

    I installed Visual Studio 6 Professional on Windows 7 Ultimate 32-bit and it is working perfectly.

    There are several things to remember:

    1) don't use the installation wizard. use the "setup.exe" and right click it and run it as administrator to start the installation.

    2) the service packs are cumulative & that means the latest service pack has all the fixes of the previous ones combined. sp4, sp5 wouldn't install because of the "mdac 2.5 thingy" but sp6 went on without a problem. remember to use the right click context menu and run the sp6 service pack installer.exe as an administrator for the installation or it won't work.

    3) once the program is installed go into the installed Visual Studio 6 folders in the root (C:\) directory & migrate shortcuts to the visual basic 6.exe, visual c++.exe, visual studio 6.exe, etc. to your desktop and use the right click and "run as an administrator" methodology on the shortcuts to start whatever Visual Studio 6 domain you wish to work with.

    4) in short run all installer.exes and startup.exes as an administrator using the right click context menu or Windows 7 will block these programs from accessing the Windows 7 registry.

    5) running programs in Windows 7 is all about permissions & some programs like Visual Studio 6 Professional need to be installed and run as system administrators.
    Last edited by John Spikowski; 21-07-2014 at 06:38.
    ScriptBasic Project Manager
    Project Site
    support@scriptbasic.org

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

    thank you for the example usage, this gave me an idea Stay tuned!


    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

  8. #28
    John,

    I realize that VB6 itself is 32-bit, but I recalled that installing it in Windows 7 64-bit was problematic. I was only suggesting the possibility that the "installer" might have been 16-bit. I have seen this before with other software. However, checking my old notes, it appears the main problem was with the JAVA installation.

    I will have to look at your article give it another try. :-)


    Petr,

    I am sure you are better equipped to figure this out than I am. ;-) It would be great if you found the entrance. ;-)



    Thanks!
    Jerry

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

    if you like the VBS syntax for Excel, why don't you combine the power of both ?

    This example shows how simple is to pass variable values from ThinBASIC to VBS.
    Uses "OS", "File"
    
    ' -- Some variable
    Long   valueOfA = 42
    
    ' -- VBA script stored as multiline string
    String myScript = "
      MsgBox("ThinBasic sent Me: " & $valueOfA)
      
      Dim var
      
      var = $valueOfA * 2
      
      MsgBox("I doubled it: " & $valueOfA)                
    "        
    
    ' -- VBA script executed
    VBA_Execute(myScript, TRUE)
    
    ' -- Function for running VBA scripts, use TRUE as second parameter, if you want to expand $variables
    Function VBA_Execute(script As String, Optional expand As Long)
      
      String tempFile = APP_SourcePath + "temp.vbs"  
      If expand Then
        script = Expand$(script)
      End If                                         
      
      FILE_Save(tempFile, script)                  
      OS_Shell("cmd /c cscript "+ tempFile, %OS_WNDSTYLE_MINIMIZED, %OS_SHELL_SYNC)
      FILE_Kill(tempFile)
      
    End Function
    

    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

  10. #30
    Thanks Petr,

    Actually, I have never used VBS ...I have been using VBA (Excel macros) to find the details of what I need to translate into PB. I could be wrong, but I assume there are differences between VBS and VBA, but perhaps not enough to be a problem. I will certainly look into what you have posted. ;-)

    Part of my problem is that I do not know what environment my projects will move to ... so I don't if they will have Excel (or which) version, which is one of the reasons I am avoiding VB.NET since you have to link in the appropriate object libraries and interop assemblies.

    So, I'm trying to keep the projects tied to something (compiler interpreter) that I know can be provided to support those projects. So, I am trying to stay as generic as possible. And that is why thinBasic came to mind. I hope to know more about the new environment before the end, but you never know. ;-)

    I'll look into your solution, but I haven't given up TB yet. ;-)

    Jerry

Page 3 of 8 FirstFirst 12345 ... 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
  •