i want to develop a Word 2007 AddIn. What i have done yet: (Everything with Visual Studio 2008 and VSTO)
1. Create a new Word 2007 Add-In
2. Insert a Ribbon with an own Button (btnOpenForm)
3. Create a new Windows Form (frmMainData)
4. Insert onClick Event for btnOpenForm
5. Insert cmd for Show.Dialog for frmMainData
In this Form i want to click on a Button and read a built in Bookmark or set this Bookmark of an ACTUALLY OPEN DOCUMENT. Cause after i start the debugger, Word opens automatically. Then i open a document with the default word -> open file menue. When i now klick and start my addin then i want to be able to use the active document.
For Reading a Bookmark i tried the following:
When i dbug my AddIn and open a new Word Document and try to get the bookmark or check if exists then i get the error:
"document = w.activedocument" -> The Command is not availabel, cause there is no Document open.
Can someone help? Thank you
Try changing your code to below:
Set doc = w.activedocument
and the 'document' variable is a keyword of VBA/Word.
you should change the name of variable such as doc