Click here to Skip to main content
15,905,563 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i am using visual studio 2008
i have tried to use this line
C#
tbl = Globals.ThisAddIn.Application.ActiveDocument.Tables.Add(myRange, ClassTable.Count(), 3);

Globals seems not known to visual studio 2008
i have included
C#
using Word = Microsoft.Office.Interop.Word;
using System.Globalization;

and i made a refrence to office.com

may be Globals. is known to other visual studio like 2012 2013 please confirm
Posted
Comments
johannesnestler 23-Jul-14 13:39pm    
Sorry I have to say this - maybe you won't like to hear it. But your question alone shows you are missing some very fundamental basics about .NET programming, spend one day to work through any basic C# tutorial. Concentrate on static vs. instance declarations, namespaces, assemblies and how to use existing code. Stop any further programming before you do this!

1 solution

I found this as a solution

var wordApplication = (Microsoft.Office.Interop.Word.Application)Marshal.GetActiveObject("Word.Application")
 
Share this answer
 
Comments
Engineer khalid 23-Jul-14 12:01pm    
hi bowlturner
i need soluton as this
when i write Globals. a listbox or menue should appear so i can choose one of them note there is a dot after Globals it is just like when u write MessageBox. u will see Show and showdialog
bowlturner 23-Jul-14 12:05pm    
this is the comment that came with the answer above

"you cant get Globals.ThisAddIn.Application in non Addin project. To get application instance in non addin project you can use"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900