Hello,
I wish to switch between the open documents window of CALC and WRITER using macros in libreoffice.
I have searched for quite a while, but am not even close.
I have a big list of things to do after this step.
Request the code for the same.
Thanks in advance.
[Solved] Switching between Calc and Writer Windows
[Solved] Switching between Calc and Writer Windows
Last edited by sanmahaan on Fri May 12, 2017 4:05 pm, edited 1 time in total.
Libreoffice 4.0.2.2 on LINUX
Re: Switching between Calc and Writer Windows
And you are going to ask us for every little item on that list? Forget it.sanmahaan wrote: I have a big list of things to do after this step.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Switching between Calc and Writer Windows
Dear Villeroy...I have seen your helpful responses in many posts...was expecting an extension of the same.
I am trying very hard to implement my ideas in Libreoffice, which I have had to switch over to recently, and trying to solve things myself.. (The big list is for me ! ) .
Also will be thankful if someone could suggest some study materials
to understand the syntax of the despatchers, UNO, et al.
Hope for helpful responses from this forum for my genuine requests.
I am trying very hard to implement my ideas in Libreoffice, which I have had to switch over to recently, and trying to solve things myself.. (The big list is for me ! ) .
Also will be thankful if someone could suggest some study materials
to understand the syntax of the despatchers, UNO, et al.
Hope for helpful responses from this forum for my genuine requests.
Libreoffice 4.0.2.2 on LINUX
Re: Switching between Calc and Writer Windows
It is depend on the fact, how you opened those documents. If you open the documents by macro, then you can use the referencesI wish to switch between the open documents window of CALC and WRITER using macros in libreoffice.
Code: Select all
oDoc_A = stardesktop.loadComponentFromURL(sURL_1,"_blank",0,array()
oDoc_B = stardesktop.loadComponentFromURL(sURL_2,"_blank",0,array()
viewtopic.php?f=45&t=59932
You can activate one or other document by the
Code: Select all
StarDesktop.setActiveFrame(...
You MUST study the API (Application Programming Interface) functions.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Switching between Calc and Writer Windows
Thank you Zizi64..Based on your input code and the links, I was able to work out and resolve my issue. Thanks once again.
Libreoffice 4.0.2.2 on LINUX
- Sébastien C
- Posts: 111
- Joined: Mon Jan 04, 2010 5:06 pm
- Location: Meymac, France
Re: [Solved] Switching between Calc and Writer Windows
Hello everybody
Open some documents.
Try this code bellow.
Enjoy!
You can have some document opened by hand.Zizi64 wrote:[...] If you open the documents by macro [...]
Open some documents.
Try this code bellow.
Enjoy!
Code: Select all
Sub activateOpenFiles As String
Dim fileName(255) As String
Dim files(255) As Object
Dim myDocuments As Object, theCollection As Object
Dim activate As Integer, i As Integer, j As Integer
theCollection = starDesktop.components.createEnumeration
i = 0
activate = 0
On Error Goto Next_1: ' In order to avoid pseudos empty windows.
While theCollection.hasMoreElements
myDocuments = theCollection.nextElement
' Avoids the macro IDE and help windows.
If (( len(myDocuments.url ) <> 0 ) And _
( left(myDocuments.url, 20) <> "vnd.sun.star.help://") _
) Then
i = i + 1
files(i) = myDocuments
fileName(i) = convertFromUrl(myDocuments.url)
Next_1:
End If
Wend
If (i >= 0) Then ' The opposite happens when no file is opened.
Redim Preserve fileName(i) ' Resize the table.
For j = 1 to i
If msgBox ("Activate:" & chr(13) & fileName(j), 36, "Activation") = 6 Then
activate = j
Exit For
End If
Next j
End If
If activate Then files(activate).currentController.frame.getContainerWindow.setFocus
End Sub
LibreOffice v. 7.3.2.2, under GNU-Linux Mint and, in virtualization and just for tests, LibreOffice v. 7.3.2.2 an OpenOffice v. 4.1.12 under M$-W 10 .