View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] korav@inbox.ru is offline
external usenet poster
 
Posts: 3
Default Toggle Design Mode in Excel by AddIn

On 20 ÎÏÑÂ, 15:04, wrote:
How could AddIn toggle Design mode in Excel? I'm talking about some
functionality like Workbook.ToggleFormsDesignMode for Excel 2007. How
could it possible for older versions?

Thank you in advance.


So, we've found it out. There is an example of code in C++ for our
AddIn. It works fine for Excel 2003 and 2007:


Excel::_ApplicationPtr pApp = NULL;

pApp = m_pParentApp;

if (pApp == NULL)
{
MessageBox(NULL, "Can't get Excel::_Application interface", "Test
Addin", MB_SETFOREGROUND);
}
else
{
try
{
Excel::_WorkbookPtr wb_ptr;

wb_ptr = pApp-GetActiveWorkbook();

wb_ptr-ToggleFormsDesign();
}
catch (_com_error err)
{
MessageBoxW(NULL, err.Description().GetBSTR(), L"Test Addin",
MB_SETFOREGROUND);
}
}



Thanks for attention, we hope it'll be useful for community.