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

[SOLVED]mailmerge.execute(Array()) needs application FOCUS !

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


Joined: 20 Aug 2010
Posts: 6

PostPosted: Fri Aug 20, 2010 5:01 am    Post subject: [SOLVED]mailmerge.execute(Array()) needs application FOCUS ! Reply with quote

Hi, I am new to this forum.
I am using Windows XP and OpenOffice 3.1.

I have a macro that tries to make a mail merge. It starts when the document is loaded.

I use the "shell" command from Visual Basic 6.0 to exeute OpenOffice as follows:

shell Full_Path_to_OppenOffice_Writer & " " docname.odt", vbNormalFocus

it runs on another window without getting ther focus, but when the macro reaches to the sentence mailmerge.execute(Array()), it stops running untill you press the mouse button on the OpenOffice window and gets the focus.

If I do not use VB 6 to call OpenOffice (I click twice on the document in the file explorer), the execution of the macro stops untill I minimize the window and get again the focus.

if I put a MsgBox "hello world" just before the mailmerge.execute sentence, and open the document with a double click in the file explorer, then the msgbox is showed and the mailmerge is executed immediately

But this little trick does not work if I use the shell command form VB 6 as the openoffice does not get the FOCUS.

thanks

Eduard


Last edited by eescrihuela on Mon Aug 23, 2010 2:24 am; edited 1 time in total
Back to top
View user's profile Send private message
eescrihuela
General User
General User


Joined: 20 Aug 2010
Posts: 6

PostPosted: Mon Aug 23, 2010 2:21 am    Post subject: Reply with quote

The problem is when I try to change the printer for the mailmerge output. I use this code
Code:

[1]oMailMerge.OutputType = com.sun.star.text.MailMergeType.PRINTER
[2]Dim mDI(1) As New com.sun.star.beans.PropertyValue
[3]'Change the printer name
[4]mDI(0).Name = "Name"
[5]mDI(0).Value = Printer_One
[6]oMailMerge.Model.setPrinter(mDI)
[7]oMailMerge.execute(Array())


if I delete lines 2 to 6 the macro does not hang while being executed as shell.

But I cannot select the printer!

I think this post should be marked as [SOLVED] as the problem is selecting the printer, and I should open a new post to find out how to change mailmerge printer!

Thanks
Eduard.
Back to top
View user's profile Send private message
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