Obj Ref not set to an instance of an Obj 
Author Message
 Obj Ref not set to an instance of an Obj

I have a problem saving an excel workbook using win 2k
and office 2k through VB.Net. The following code works
fine using win xp and office xp.

xlWkBk = xlApp.Workbooks.Add
xlWkBk.SaveAs()

The following gives the same error

xlWkBk = xlApp.Workbooks.Add
xlWkBk.SaveAs(strPath) 'strPath is a valid Path and file  
                       'name.

I get an error that says Object refrence is not set to an
instance of an Object. Does anyone know what is causing
this? I can add/remove sheets to/from xlWkBk and modify
them with no problem.



Wed, 09 Nov 2005 00:57:15 GMT  
 Obj Ref not set to an instance of an Obj
Jason,

See if this works.
---
   xlWkBk.ActiveWorkbook.SaveAs(strPath)
   xlWkBk.ActiveWorkbook.Saved = True
---

Vince


Quote:
> I have a problem saving an excel workbook using win 2k
> and office 2k through VB.Net. The following code works
> fine using win xp and office xp.

> xlWkBk = xlApp.Workbooks.Add
> xlWkBk.SaveAs()

> The following gives the same error

> xlWkBk = xlApp.Workbooks.Add
> xlWkBk.SaveAs(strPath) 'strPath is a valid Path and file
>                        'name.

> I get an error that says Object refrence is not set to an
> instance of an Object. Does anyone know what is causing
> this? I can add/remove sheets to/from xlWkBk and modify
> them with no problem.



Wed, 09 Nov 2005 01:19:27 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Dim obj As New Class crt Dim Obj As Class = New Class

2. CR Engine Obj Lib vs CR Designer Component Obj Model

3. COM+ obj calling another COM+ obj

4. Setting Obj = Nothing does not free memory

5. Basic question...how to check obj set to Nothing

6. Set obj = nothing

7. Help with set obj and dereferencing?

8. set obj = new Timer ??

9. How to link Visual C created OBJ(NOT DLL) file

10. Database obj not in VB4 Enterp?

11. obj.GetRows not working!

12. Set obj = nothing without obj.close , Have any bad effect ?

 

 
Powered by phpBB® Forum Software