The Type or namespace for activex objects could not be found

a1jit

Regular
Joined
Aug 19, 2005
Messages
89
Guys,

i just developed a simple code, opening up excel file..

And i keep getting error message saying that namespace for activexOject
could not be found..

I have already included Microsoft ActiveXObject reference here..still getting the error..

Aany idea how to deal with this>


Code:
// Declare the variables
			Excel.Application oXL;
			Excel._Workbook oWB;
			Excel._Worksheet oSheet;

			// Create the Excel application object.
			oXL = new ActiveXObject("Excel.Application");

			oXL.Visible = true;

			((Excel.Worksheet)oWB.Sheets[2]).Select(
				Type.Missing);

			oSheet = (Excel._Worksheet)oWB.ActiveSheet;
 
a1jit said:
Guys,

i just developed a simple code, opening up excel file..

And i keep getting error message saying that namespace for activexOject
could not be found..

I have already included Microsoft ActiveXObject and microsoft scripting runtime reference here..still getting the error..

Aany idea how to deal with this>


Code:
// Declare the variables
			Excel.Application oXL;
			Excel._Workbook oWB;
			Excel._Worksheet oSheet;

			// Create the Excel application object.
			oXL = new ActiveXObject("Excel.Application");

			oXL.Visible = true;

			((Excel.Worksheet)oWB.Sheets[2]).Select(
				Type.Missing);

			oSheet = (Excel._Worksheet)oWB.ActiveSheet;
 
If you are doing this through .Net you will not require a reference to the scripting runtime, just create a reference to the relevant office / excel component and then you should be able to create an instance with code similar to
C#:
Excel.Application oXL;
Excel._Workbook oWB;
Excel._Worksheet oSheet;

// Create the Excel application object.
oXL = new Excel.Application;
 
Back
Top