The Globals object I have does not contain a property Sheets. Where is the Globals object defined?
This does not work for me.
Excel.Range rng = Globals.Sheets("Sheet1").R
Thanks,
Main Topics
Browse All TopicsUsing Visual Studio tools for Office (2005), I'm trying to develope a C# .NET module that will interact with my C# server which updates live stock quotes. I can easily interact with my module from Excel, but I have 2 problems:
1) I'd like to create an Excel RTD module in C#, so that I can embed custom formulas into cells, that will be updated in realtime.
2) From an Excel Add-in, I can add my menu to excel, and interact with it, but I cannot write a number into a spreadsheet cell. Every example I've seen looks like:
Excel.Range rng = Globals.Sheet1.Range["A1",
rng.Value2 = "socket state: " + state;
My problem is that I don't know where the Globals static object is defined. The wizard I used to create an Excel addin created a Globals object that does not contain a Sheet1 variable. Where is this thing defined? and how can I use it, or is there a better way to poke text into a spreadsheet using an Excel Add-in?
Thanks,
Gerry
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Try:
Excel.Application objApp;
Excel._Workbook objBook;
Excel.Workbooks objBooks;
Excel.Sheets objSheets;
Excel._Worksheet objSheet;
Excel.Range range;
objApp = new Excel.Application();
objBooks = objApp.Workbooks;
objBook = objBooks.Add( Missing.Value );
objSheets = objBook.Worksheets;
objSheet = (Excel._Worksheet)objSheet
range = objSheet.get_Range("A1", Missing.Value);
range.Value = "socket state: " + state;
Kevin
Thanks for your help. This is what eventually worked for me, it is simular to what you suggested, I found the syntax in an MS forum. Why they could not post a simple example somewhere I don't know. The key was using get_Range, and getting the Worksheet cast done correctly.
((Excel.Worksheet)Applicat
Business Accounts
Answer for Membership
by: zorvekPosted on 2007-07-26 at 17:19:44ID: 19579337
Try:
ange["A1", missing];
Excel.Range rng = Globals.Sheets("Sheet1").R
rng.Value = "socket state: " + state;
Kevin