Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.com.add_ins
external usenet poster
 
Posts: 2
Default OnStartupComplete and activeworkbook

hi all

I have a COM add-in for excel. I want to get the workbook (xls) name when it
loads. So inside
OnStartupComplete i use the valid IDispatch application pointer and query
for the active workbook. Now this works when I click on the xls file
directly, or if i start excel from the command line and pass it the complete
xls file name. However, if I create a shortcut to the xls file and then
start excel by double clicking this the code fails. The workbook is null.

I have noticed that when starting excel in this manner (a shortcut to and
xls file) it is run with the /e flag, which means to start with no workbook.
and I think this is the problem because OnStartupComplete is called before
the xls is actually loaded.



I am wondering if any of you have found this and have a workaround i could
use.



tia



mike




  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.com.add_ins
external usenet poster
 
Posts: 18
Default OnStartupComplete and activeworkbook

Hi MIke,
"OnStartupComplete" get fired when your add-in gets loaded in Excel
instance then your workbook loads in Excel.
You can get the name of the workbook in "WorkbookOpen" event of
Application Object.


Vinit

  #3   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.com.add_ins
external usenet poster
 
Posts: 2
Default OnStartupComplete and activeworkbook

hi Vint

yes indeed you can. Although as I am doing this from a COM add-in in c++
its quite a bit of work to have to implment connection point etc.

the funny thing is that if I open the workbook directly i can get the name,
but if i open the workbook via a shortcut I dont get the workbook.

I can see that from a shortcut excel is opened with the /e switch and it
seems that excel opens, the StartupComplete is fired and then the workbook
loads. Whereas if you open the workbook directly (not a shortcut) then the
workbook is loaded before OnStartupComplete is called.


mike


"Vinit" wrote in message
oups.com...
Hi MIke,
"OnStartupComplete" get fired when your add-in gets loaded in Excel
instance then your workbook loads in Excel.
You can get the name of the workbook in "WorkbookOpen" event of
Application Object.


Vinit



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveWorkbook.RefreshAll teepee[_3_] Excel Discussion (Misc queries) 0 November 11th 08 02:11 PM
ActiveWorkBook Pete Excel Discussion (Misc queries) 3 May 9th 05 04:14 PM
ActiveWorkbook.SendMail Sandy Excel Programming 2 March 15th 05 07:17 AM
activeworkbook problems texastig Excel Programming 1 February 23rd 05 03:01 AM
ActiveWorkbook.RefreshAll Mark[_22_] Excel Programming 0 October 15th 03 02:22 AM


All times are GMT +1. The time now is 07:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"