Marc Santhoff wrote:
Am Dienstag, den 03.01.2006, 17:53 -0500 schrieb Andrew Jensen:
  
I'm curious, how did you register the connection? Did you use the dialog
and assigned the macro or did you do it out of a program?

If maually: there is a difference bewteen having the event connected on
document or application level...

  
Sorry, I don't know why I changed the message thread on this...
I manually register from Tools>Customize and it is set on application level. This is on 2.0.1 by the way.

  
That looks like a bug in OO.o 1.0.x where macros called from the
commandline when starting the office where invoked twice. Should be
fixed somewhere in the step to 1.1, but using a global boolean outside
any sub did fix it for me.

global hasrun as boolean

sub importCSVfromCommandline(file as string)
	dim typ as string
	typ = left(FileNameoutofPath(file),2)
	msgbox file + " : " + typ
	importCSV(file, typ)
end sub

sub importCSV(file as string, typ as string)
	if hasrun = FALSE then
		hasrun =TRUE
	else
		exit sub
	end if
	...

This way it *did* work.

  
I will give this a try and let you know..

  
The oddity. While testing this libraries routines I happened to use drag 
and frop to move an embedded form from one Base file to another.
Guess what happens. The onOpenDocumentMain procedure is called AND with 
the library NOT in the editor it is
called only once??? For those that are interested, the dbName variable 
is set to the target frame's Base name.
    

Are you sure the library your macro lives in is loaded already when the
event fires? The whole story sounds like this is a global space library,
but if you need to use macros from let's say "Tools" you've got to load
it before calling. But to be honest I don't know how to seperate the
chicken and the egg here - how can OO.o be told to load a library at the
start?

  
I am sure, I was sending out a print statement for testing..and it does just that..I have the feeling you hit the fix with the
example above.

Yes, it all helps. Thanks again.

Reply via email to