Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Weird error
Hi
I am getting a error saying "?" for the following line: Worksheet =(Worksheet)workbook.Worksheets.Add(Type.Missing, Type.Missing,Type.Missing, Type.Missing); does any one has an explanation to this, i mean how could an error have no explaination and just show a "?" on ex.Message (Exception ex) Please, help me out.. i don't know what to do! Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Weird error
Hi
Worksheet and workbook are not good variable names as they are objects in Excel VBA. If you want to create a new worksheet in your workbook try: Set myWorkSheet = myWorkBook.WorkSheets.Add where you might have done Set myWorkBook = Application.Workbooks("Tester") or Set myWorkBook = ActiveWorkBook look at the parameters in the Add method for control over where it goes in the workbook. regards Paul |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Weird error
Your talking about VBA and the OP is talking about .NET.
-- Regards, Tom Ogilvy " wrote: Hi Worksheet and workbook are not good variable names as they are objects in Excel VBA. If you want to create a new worksheet in your workbook try: Set myWorkSheet = myWorkBook.WorkSheets.Add where you might have done Set myWorkBook = Application.Workbooks("Tester") or Set myWorkBook = ActiveWorkBook look at the parameters in the Add method for control over where it goes in the workbook. regards Paul |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Weird error
hi,
that was just example line so that it would be easy to understand i have thought not used that same names.. one more thing.. i am trying to develop excell addin through c# now when i try n create a worksheet in active workbook it gives me this error in that line which has ex.message as "?" nothing else.. Mind you this error is not a fixed one, i mean this error is not always occuring.. it many times works fine and some times gives the error..(i know this is absurd.. but?) |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Weird error
hi Tom,
U r absolutely right! And plzz if you know some thing about this help me.. i am stuck Thanks |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Weird error
I really don't know anything about C# and .NET, but shouldn't it be something
like: Excel.Application oXL; Excel._Workbook oWB; Excel._Worksheet oSheet .. . . oSheet = (Excel._Worksheet) oWB.Worksheets.Add(Missing.Value, Missing.Value, Missing.Value, Missing.Value); Missing.Value instead of Type.Missing -- Regards, Tom Ogilvy "Adi" wrote: hi Tom, U r absolutely right! And plzz if you know some thing about this help me.. i am stuck Thanks |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Weird error
Thanks Tom but as far as I know Missing.Value and Type.Missing gives
the same result. If there are any differences that you know, please let me know too. :) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Weird Arithmetic Error | Excel Discussion (Misc queries) | |||
Very weird error | Excel Worksheet Functions | |||
vlookup weird error | Excel Worksheet Functions | |||
Weird error messages | Excel Discussion (Misc queries) | |||
Weird error | Excel Programming |