LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default How do I reference a Worksheet from a Form (Add-in for Excel 2003)

Hi.
How can I reference the Worksheet (and Application) from a Form in an Add-in
for Excel 2003? I have tried this code:

Excel.Worksheet sheet = (Excel.Worksheet)this.Sheets["Sheet2"];
sheet.Select(Type.Missing);
Excel.Range newFirstRow = sheet.get_Range("A1", Type.Missing);
newFirstRow.Value2 = "This text was added by using code";

But I only get an error telling me that 'Form1' does not contain a
definition for 'Worksheets'.

I also tried this:

Excel.Worksheet sheet =
((Excel.Worksheet)Application.ActiveSheet);

Which led to the following error:
'System.Windows.Forms.Application' does not contain a definition for
'ActiveSheet'

My goal is to do some calculations with my Add-in, present a summary of the
calculations in the Add-in while saving all calculations in the Excel calling
the Add-in.
I am using Visual Studio 2008 for programming an Add-in for Excel 2003.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 - Copy Down Function to Reference Next Worksheet Lmarsh1693 Excel Worksheet Functions 4 May 18th 12 02:09 AM
Drop-down list on simple excel 2003 form using "form" from data me S Beals Excel Discussion (Misc queries) 0 March 2nd 10 08:35 PM
How do I get 2003 Macros and Toolbar Buttons form Excel 2003 to 20 Scott Sornberger New Users to Excel 2 March 19th 08 11:42 AM
How do I save worksheet form data into a table in Excel 2003? Bob S. Excel Discussion (Misc queries) 0 December 31st 05 04:33 PM
Reference Access created form in excel Ryan Patch Excel Programming 0 January 31st 04 08:01 PM


All times are GMT +1. The time now is 12:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"