vipinsasi said:
Dear All,
I am new to excel Programming.I have some (set of)basic doubts which
may irritate you people.Please excuse me.
1.Where excel macros will be stored?
In a workbook
2.Is it possible to write a macro (common )which all excel files can
use.
If the workbook is open and the sub is public, then any other open workbook
can execute the macro using the Run command. If you create a reference to
the workbook containing the macro, then you can run it as if it were stored
in the calling workbook. A common practice is to put the macro in an Addin.
If the addin is selected by the user, then it will be open when excel is
opened manually. It will not be opened if excel is opened with code.
3.I have an excel macro which Macro's text will be stored in SQL
database.Wat i need is to run the macro in an excel sheet
programatically.(I am using C#).I will select the macro name and
corresponding text will be displayed in a richtextbox.When i say run
macro,an excel files should open and run the macro.All should be done
automatically.
You would have to transfer the string that constitutes the macro's code to a
module in Excel and then execute it, however, you can control Excel using
Automation directly from C#, so you proposed approach appears to be the long
way around the block.
For working with the VBE with code
http://www.cpearson.com/excel/vbe.htm
See below for links to code samples
4.How to find an excel sheet is BLANK programtically?
in VBA
If Activesheet.UsedRange.count = 1 and isempty(range("A1")) then
' the sheet is blank and has no special formatting applied.
End if
Please let me know if i am not clear.
Expecting some advise/guidance with some sample code.Thanks in
advance.
Regards,
V
Here is a good overview article: (it has a lot of links as well, some of
which may be duplicated below)
http://support.microsoft.com/default.aspx?scid=kb;en-us;311452&Product=vcSne
t
INFO: Develop Microsoft Office Solutions with Visual Studio .NET
Here are some code samples in C#:
http://support.microsoft.com/default.aspx?scid=kb;en-us;302096&Product=vcSne
t
HOWTO: Automate Excel with Visual C# .NET to Fill or to Obtain Data in a
Range by Using Arrays
http://support.microsoft.com/default.aspx?scid=kb;en-us;303872&Product=vcSne
t
HOWTO: Create an Excel Macro by Using Automation from Visual C# .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;302084&Product=vcSne
t
HOWTO: Automate Microsoft Excel from Microsoft Visual C# .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;302815&Product=vcSne
t
HOW TO: Handle Events for Excel by Using Visual C# .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;823981&Product=vcSne
t
HOW TO: Handle Events for Excel by Using Visual C# .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;307029&Product=vcSne
t
HOW TO: Transfer XML Data to Microsoft Excel 2002 by Using Visual C# .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;303018&Product=vcSne
t
HOWTO: Use Automation to Create Office Command Bars and Controls with Visual
C# .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;317109&Product=vcSne
t
PRB: Office Application Does Not Quit After Automation from Visual Studio
..NET Client
http://support.microsoft.com/default.aspx?scid=kb;en-us;306023&Product=vcSne
t
HOW TO: Transfer Data to an Excel Workbook by Using Visual C# .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;320523&Product=vcSne
t
HOW TO: Check the Type of a COM Object (System.__ComObject) with Visual C#
..NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;311194&Product=vcSne
t
HOW TO: Use ASP.NET to Query and Display Database Data in Excel by Using
Visual C# .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;318452&Product=vcSne
t
HOW TO: Retrieve Meta Data from Excel by Using GetOleDbSchemaTable in Visual
C# .NET