OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

select different document in macro

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
pablosanchez
Guest





PostPosted: Wed Jun 25, 2003 4:31 pm    Post subject: select different document in macro Reply with quote

Hi, i use a macro to open a csv document and do some formatting for display
The thing is : how i do to close the original macro document ?
When i open the csv, it recieves the focus, so the original one loses it.
All i have to do is get the focus of it and close it, leaving the csv alone opened.
Have looked at the tutorial.pdf and still can´t figure out this.
---

Sub Main
Dim oDesktop, oDocument As Object
Dim sUrl As String
Dim mFileProperties(2) As New com.sun.star.beans.PropertyValue
dim document as object
dim dispatcher as object
dim oEl as object

sUrl = "file:///c|/listado.csv"
mFileProperties(0).Name = "FilterName"
mFileProperties(0).Value = "scalc: Text - txt - csv (StarCalc)"
mFileProperties(1).Name = "FilterFlags"
'mFileProperties(1).Value = "44/MRG,34,SYSTEM,1,1/4/2/1/4/2/5/2/7/4"
mFileProperties(1).Value = "44/MRG,34,,1,1/4/4/2/5/2/7/4"


'/10/10/11/10/12/10/13/10/14/10/15/10/16/10/17/10/18/10/19/10/20/10/21/10/22/10/23/10/24/10/25/10/26/10/27/10"
oDesktop = createUNOservice("com.sun.star.frame.Desktop")
oDocument = oDesktop.loadComponentFromURL(sUrl,"_blank",0,mFileProperties())

' I should select and close the original doc here..
End Sub


---
Thanks in advance.
Back to top
dfrench
Moderator
Moderator


Joined: 03 Mar 2003
Posts: 1605
Location: Wellington, New Zealand

PostPosted: Fri Jun 27, 2003 6:30 pm    Post subject: Reply with quote

I assume that your macro is in a document rather than [soffice].standard so you can reference it as 'thiscomponent' so
Code:
thiscomponent.close(false)
and your document (and macro) will disappear
Back to top
View user's profile Send private message
pablosanchezuy
Guest





PostPosted: Sun Jun 29, 2003 9:03 pm    Post subject: Thanks !! Reply with quote

dfrench, that did it.
The doc with the macro is a csv viewer , the result of a process in one application
i´m doing in Clarion for Windows. I used before OOo, staroffice5.2 and excel.
This will be the replacement for both, definetly.
I´m trying to switch any client i have to OOo and i can say people is quite happy
with the results. Of course, some MS people don´t talk any good about me,
not to mention all Nt/2K servers replaced with samba, postfix, courier-imap, etc Very Happy
Hope move to java soon.

Best regards
Pablo Sánchez.
Montevideo, R.O de Uruguay.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group