Modify

Opened 11 years ago

Closed 11 years ago

#2295 closed Feature Request (Fixed)

Help on ObjGet

Reported by: MvL Owned by: guinness
Milestone: 3.3.9.5 Component: Documentation
Version: Severity: None
Keywords: ObjGet Cc:

Description (last modified by trancexx)

I had to add an empty function, to make example two work,
in the help on ObjGet.

   Func nothing()
   EndFunc

Also,
in order to activate the worksheet, I added

$oExcelDoc.Application.Windows($Worksheet).Activate

in the code below,
See also my Example script:

Getting the right Excel window, using ObjGet

Local $Worksheet = "Worksheet.xls"
Local $Filename = "C:\" & $Worksheet

If Not FileExists($FileName) Then
    MsgBox(0, "Excel File Test", "Can't run this test, because you didn't create the Excel file " & $FileName)
    Exit
EndIf

Local $oExcelDoc = ObjGet($FileName) ; Get an Excel Object from an existing filename


If IsObj($oExcelDoc) Then

    ; Tip: Uncomment these lines to make Excel visible (credit: DaleHohm)
    $oExcelDoc.Windows(1).Visible = 1; Set the first worksheet in the workbook visible
    $oExcelDoc.Application.Visible = 1; Set the application visible (without this Excel will exit)

; and:
    $oExcelDoc.Application.Windows($Worksheet).Activate

    Local $String = "" ; String for displaying purposes

    ; Some document properties do not return a value, we will ignore those.
    Local $OEvent = ObjEvent("AutoIt.Error", "nothing"); Equal to VBscript's On Error Resume Next

    For $Property In $oExcelDoc.BuiltinDocumentProperties
        $String = $String & $Property.Name & ":" & $Property.Value & @CRLF
    Next

    MsgBox(0, "Excel File Test", "The document properties of " & $FileName & " are:" & @CRLF & @CRLF & $String)

    ; $oExcelDoc.Close ; Close the Excel document

Else
    MsgBox(0, "Excel File Test", "Error: Could not open " & $FileName & " as an Excel Object.")
EndIf

Attachments (0)

Change History (3)

comment:1 Changed 11 years ago by TicketCleanup

  • Version 3.3.8.1 deleted

Automatic ticket cleanup.

comment:2 Changed 11 years ago by trancexx

  • Description modified (diff)

The line with ObjEvent needs to go away from current example.

comment:3 Changed 11 years ago by guinness

  • Milestone set to 3.3.9.5
  • Owner set to guinness
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [7475] in version: 3.3.9.5

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain guinness.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.