To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=111804
                 Issue #|111804
                 Summary|BASIC code cannot access sheets when in preview mode
               Component|Spreadsheet
                 Version|OOo 3.2
                Platform|Opteron/x86_64
                     URL|
              OS/Version|Linux
                  Status|UNCONFIRMED
       Status whiteboard|
                Keywords|
              Resolution|
              Issue type|DEFECT
                Priority|P3
            Subcomponent|programming
             Assigned to|spreadsheet
             Reported by|apteryx





------- Additional comments from [email protected] Mon May 24 15:31:37 
+0000 2010 -------
What is expected : When I open a calc document containing a macro triggered on
"open document" and which has the effect of selecting a sheet by default, it
should be able to select the sheet I want even if the document was saved in
"preview" display mode.

What is observed : When I open my document, which is saved in the "preview" mode
and contains a macro that choose a specific sheet assigned to the action "Open
Document", BASIC throws an error and says it cannot access property or method
called setActiveSheet.

Steps to reproduce problem :

1. Create a Calc spreadsheet. Save it under the name "test".

2. Create a macro : go in Tools -> Macros -> Manage Macros -> OpenOffice.org
Basic. Navigate to the standard macro library of the current spreadsheet
(test.ods -> Standard) and click on the "New" button. Name this module
"test_macro" and press "OK". Now between the sub and end line of the Basic code,
copy the following code : 

        oController = ThisComponent.CurrentController
        oController.setActiveSheet(ThisComponent.sheets(0))

This macro, when executed, put focus on the leftmost worksheet (sheet 1).

3. You can now compile the code using the "Compiler" icon. You can execute it,
it shouldn't fail at this stage (as our document is not in preview mode). Close
the Basic code editor.

4. Next, we assign our newly created macro to the "Open Document" event. Go in
Tools -> Personalize (customize) and in the "Events" tab, select "Open a
document". Click on "Macro" button, and browse to your macro under test.ods ->
Standard -> test_macro. Click OK. This will trigger our macro every time we open
our test.ods document.

5. Finally, click the "Preview" button or select File -> Preview. Save the
document in this state (File -> Save).

You can now close the document. Upon opening it again, Calc will inform you of a
Basic error with a popup : "Basic execution error. Property or method not found
: setActiveSheet" This only happens if the document is saved in the preview 
display.

The test.ods file produced by following these steps is attached for quick 
testing.

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to