How to Get Reference of CommandBar in Excel?

  • Thread starter Ahmad Jalil Qarshi
  • Start date
A

Ahmad Jalil Qarshi

hi!

i am using VC7 and Office 2003. I want to add a toolbar in EXCEL with some
buttons. i have done that for word already. First i get the reference of the
CommandBar using the following code.

HRESULT hr;

CComPtr<Office2003::_CommandBars> spCmdBars;

//QI() for application.

CComQIPtr<MSWord::_Application> spWordApp(m_pApplication);

ATLASSERT(spWordApp);

m_pWordApp = spWordApp;

hr = m_pWordApp->get_CommandBars(&spCmdBars);

so now when i try to do the same with Excel i receive an error message that
get_CommandBars is not member of m_pExcelApp.

i don't know how to do that.

so if any body knows about that then please help me. i m in hurry.

Thanks.

Ahmad Jalil Qarshi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top