PDA

View Full Version : Taming Illustrator CS



hairywhiterabbit
01-10-2005, 01:21 AM
Hi all,

I hope someone else on the planet has used Illustrator VBA before....

I have been using a Word macro to obtain diagrams from Illustrator for insertion into Word. The actual macro works fine, but(!), when a visible instance of Illustrator is already open the screen focus switches to Illustrator when a document is openned or manipulated which slows the code down considerably.

I have tried using LockWindowUpdate, SendMessage and ShowWindow APIs without much luck. I think some of these don't work because Illustrator has many windows as sub menus.

Any suggestions/sympathy would be appreciated.

Cheers,
Andrew

Jacob Hilderbrand
01-10-2005, 01:40 AM
I don't have Illustrator to check this, but can you use GetObject to try and get the Illustrator application. If it isn't open there will be an error so use On Error Resume Next. If it exists try to set the Visible property to False.

hairywhiterabbit
01-10-2005, 01:47 AM
Hi,

Thanks for the quick reply! I can access Illustrator and perform all the necessary copying and pasting functions without a problem. It is the fact that the screen focus swaps to Illustrator (much like Word does when you run a macro from Excel with the visible property set to true) that slows the process down.

Unfortunately Illustrator does not have a visible property.

Cheers,

Andrew

Jacob Hilderbrand
01-10-2005, 01:56 AM
How about this. Check if Illustrator is open. If it is not just run the macro, but if it is open pop up a Message Box stating that the user should close Illustrator or the macro will run slow. If they want to run the macro anyways then run it otherwise quit based on the result from the YesNo Message Box.

hairywhiterabbit
01-10-2005, 02:11 AM
Yeah, I might have to do that. Actually, it may be better to use an API to totally hide the window (rather than try stopping windows switching to Ill or stopping the Ill window updating) while the code is running and then display it again when it has finished. The Ill taskbar icon will disappear and reappear, but it is the lesser of two evils.

Thanks for your suggestion.

Jacob Hilderbrand
01-10-2005, 02:37 AM
You're Welcome

Take Care