borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (sending information to outlook calendar)Next Topic (function tooltips) New Topic New Poll Post Reply
AndreaVB Forum : VBA (Access, Excel, Word, ...) : WorkbookOpen & double-clicked .XLS file from explorer...
Poster Message
onecheapdrunk
Level: Trainee

Registered: 13-03-2006
Posts: 1

icon WorkbookOpen & double-clicked .XLS file from explorer...

Hi all,

I hope I'm not asking something really obvious here but....

I'm using the 'WorkbookOpen' event in VBA. This is saved in a class module in a workbook that is loaded during startup with Excel (v2003 Pro SP2) via the XLSTART directory. This macro runs fine. If I start Excel, the workbook loads, my macro recognises the WorkbookOpen event and I get a splash screen to say that it's running. What it then does is sits and waits until I open particular .XLS sheets and modifies them. This is all by design and is working as it should be.

BUT - If I attempt to start Excel by double-clicking on a .XLS sheet from within Explorer (for example), the first workbook is loaded (with my macro and the Workbookopen event), but NOT the .XLS sheet I just double clicked on! I then have to go back and re-double-click on it so that Excel will load it.

For clarification: Excel starts fine and will load a double clicked XLS sheet from within explorer if I disable the Workbookopen event.

If I start Excel from a normal shortcut, my macro loads, I get a splash screen and all is well. I can then load my selected workbook from [file][open], etc... with no problems and the macro works as it should.

I have tried making the VBA project an Addin. The only difference is that Excel then loads a new (blank) worksheet after loading Excel and my macro... but still will not open a double-clicked workbook.

It would appear that WorkbookOpen is not handing off control to Excel for any further workbooks that are opened at the same time as it is. Possibly not passing along environment variables that show Excel which workbook to load next? i.e. %1 %2 (for the DOS fans out there...)

Has anyone else had this same trouble with WorkbookOpen?

Thanks!

Dan

13-03-2006 at 11:47 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VBA (Access, Excel, Word, ...) : WorkbookOpen & double-clicked .XLS file from explorer...
Previous Topic (sending information to outlook calendar)Next Topic (function tooltips) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder