Announcement

Collapse
No announcement yet.

ExcelApp.inc

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ExcelApp.inc

    Can anyone point me to a copy of ExcelApp.inc?

    Also, in the example ExcelAp1.bas, it shows how a new worksheet can be added. However, how can we switch control between the 4 different worksheets?

    I am new with PB. Any help/insight/direction to more PB resources on EXCEL programming will be greatly appreciated.

    Thanks!

  • #2
    I have not tried it but the Excel Application Interface has a WorkSheet property get that will return an interface reference to a worksheet given the sheet number, then use this interface reference to work with that particular sheet.
    Code:
    Pseudo Code:
    object get ExcelApplicationInterface.WorkSheets(WorkSheet Number) to ExcelWorksheet
    object let ExcelWorkSheet.Cells(1, 1).Value = "Test"
    ExcelApp1.inc should be in the same directory as the ExcelAp1.bas file. ExcelApp1 was created with the PB COM Browser, which can be found by selecting Tools | COM Browser in the IDE.
    Last edited by Steve Rossell; 18 Jul 2008, 04:01 PM.
    Sincerely,

    Steve Rossell
    PowerBASIC Staff

    Comment


    • #3
      I found the ExcelApp1.inc. Thanks Steve.

      I tried your idea but I am having problem with the syntax. In ExcelAp1.bas, instead of creating a new worksheet, can you show me how we can just access worksheet 1 (Sheet 1).

      So instead of the following statement in the example:

      OBJECT CALL oExcelWorkBook.WorkSheets.ADD TO oVnt

      What statement(s) will be required?


      Your help will be greatly appreciated.

      Comment


      • #4
        Try,
        Code:
            ...
            LOCAL oSheet AS ExcelWorksheet
            ...
            OBJECT GET oExcelWorkBook.WorkSheets.Item(vSheet) TO vSheet
            oSheet = vSheet
            OBJECT CALL oSheet.Activate
            OBJECT LET oSheet.Cells(vCell1, vCell2) = vText
        Sincerely,

        Steve Rossell
        PowerBASIC Staff

        Comment

        Working...
        X