Bug 54721 - In VBA mode ActiveDocument is not tracking currently selected document
Summary: In VBA mode ActiveDocument is not tracking currently selected document
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
4.0.0.0.alpha0+ Master
Hardware: Other All
: medium normal
Assignee: Noel Power
URL:
Whiteboard: target:3.7.0
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-10 10:02 UTC by Noel Power
Modified: 2013-11-05 10:15 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
test document (36.00 KB, application/vnd.ms-excel)
2012-09-10 10:04 UTC, Noel Power
Details
another test document (30.50 KB, application/vnd.ms-excel)
2012-09-10 10:07 UTC, Noel Power
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Noel Power 2012-09-10 10:02:20 UTC
when switching between calc documents the VBA enabled api should be aware of the current application specific document type. E.g. the excel interop api should be aware of the last selected ( e.g. current ) calc document. This is not happening at the moment and this can cause for example the api to interact with the wrong document.
Comment 1 Noel Power 2012-09-10 10:04:05 UTC
Created attachment 66915 [details]
test document
Comment 2 Noel Power 2012-09-10 10:07:44 UTC
Created attachment 66917 [details]
another test document

open the first and second documents in libreoffice, each document has some content in the A1 cell, "ActiveDocument1" and "ActiveDocument2" respectively. Each document has a button to run a macro which will output the content of cell A1 of the currently active document. So, the expectation is if you click the button of ActiveDocument1 you should get a message box saying "ActiveDocument1" and similarly get a message box saying "ActiveDocument2" if you click the button of document ActiveDocument2. What you will find is that the same message will be displayed which clicking each button. This is because the active document is not updated correctly
Comment 3 Not Assigned 2012-09-10 10:17:19 UTC
Noel Power committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=cea414bfe8fe356793778bdf09f5ca3b3a42daa0

fdo#54721 fix vba not tracking currently selected doc correctly



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 4 Joel Madero 2012-12-11 16:23:11 UTC
Noel: can we close this one as fixed?
Comment 5 Noel Power 2012-12-14 09:27:33 UTC
closing, was fixed, if it's broken again then imo that's a new issue
Comment 6 Justin L 2013-11-05 10:15:25 UTC
reopened as bug 71248