Instance member does not exist

I have written the code like this but I got error in save methoderror is “Instance member does not exist”

pls guide me that how to solve the problem

Sub Click(Source As Button)

Dim ws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument



Dim ss As New NotesSession

Dim db As NotesDatabase

Dim vw As NotesView

Dim doc As NotesDocument	

Dim item As NotesItem

Dim  filepath As String, pathname As String

Dim filenum As Integer

Dim x As Variant, y As Variant



On Error Goto Errorhandle	



Set uidoc=ws.CurrentDocument

Set db=ss.CurrentDatabase

Set vw=db.GetView("Configuration")

Set doc=vw.GetFirstDocument()

Set item= doc.GetFirstItem("ExcelfileName")



filepath$=item.Text



filenum=Freefile()

’ Open Excel Application

If  Len(Dir(filepath$))>0 Then Kill filepath$

Open filepath$ For Output As filenum



Set z=createobject("Excel.Application")

Set y=z.Workbooks.add



z.visible=True

z.caption="Exporting From Notes Current Document  to Excel"

z.worksheets(1).Name="Customer Info"

z.worksheets(1).Range("A1").value="Customer Details"

z.worksheets(1).Range("A3").value=" Name"

z.worksheets(1).Range("B3").value="Email"

z.worksheets(1).Range("C3").value="Phone"

z.worksheets(1).Range("D3").value="City"

z.worksheets(1).Range("E3").value="Address"

’ Export Data from Notes Document

i=2

Set  x=z.workbooks(1).worksheets(1)



If Not uidoc Is Nothing Then

	Gosub Export

End If

If uidoc Is Nothing Then

	Gosub Terminate

End If

’ Export Values from Out Door View

Export :

s="A"+Cstr(3+i)+":C"+Cstr(3+i)

x.cells(i+3,1).value=Cstr(uidoc.FieldGetText("CuName"))  ' Item

x.cells(i+3,2).value=Cstr(uidoc.FieldGetText("CuEmail"))   ' Item

x.cells(i+3,3).value=Cstr(uidoc.FieldGetText("CuPhone"))  ' Item

x.cells(i+3,4).value=Cstr(uidoc.FieldGetText("CuCity"))        'item

x.cells(i+3,5).value=Cstr(uidoc.FieldGetText("CuAddress"))'Item	

'Set x=Nothing

z.SaveAs(filepath$) 'I got the error here

z.Quit

Set z=Nothing





Close filenum

Terminate :

Exit Sub

Errorhandle:

Messagebox "Error:" &  Error & " at line " & Cstr(Erl)

End Sub

thanks&regards

Subject: Instance member does not exist

Where is the error occuring? There are a few places I can see things going wrong:

For example:

Set vw=db.GetView("Configuration")

Set doc=vw.GetFirstDocument()

You don’t check to make sure that vw got a value. So the Doc Assignment could fail.

Set vw=db.GetView("Configuration")

if vw is Nothing then Exit Sub

Set doc=vw.GetFirstDocument()

However, this may not be the problem.

Subject: Instance member does not exist

This is the line I use to do a SaveAs in Excel:

xlapp.activeworkbook.saveas “c:\temp\envsource.xls”

Subject: Instance member does not exist

which line does it error on?

Subject: RE: Instance member does not exist

z.ActiveWorkbook.SaveAs(filepath$) //i GOT THE ERROR HERE Set z=Nothing

z.Quit

After changes i got this error

can not access exporttoexcel.xls

Subject: RE: Instance member does not exist

You have filepath$ open for output, that is why you cannot save it.

Subject: RE: Instance member does not exist

filepath$ is incorrect