Urgent please :Cannot access the file name

ERROR:CAN NOT ACCESS THE EXPORT TO EXCEL.XLS(THIS IS THE FILE NAME)

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





On Error Goto Errorhandle	



Set uidoc=ws.CurrentDocument

Set db=ss.CurrentDatabase

Set vw=db.GetView("Configuration")

If vw Is Nothing Then Exit Sub

Set doc=vw.GetFirstDocument()

Set item= doc.GetFirstItem("ExcelfileName")

'Msgbox item.Text

filepath$=item.Text

'Msgbox filepath$

filenum=Freefile()

'pathname$=Dir$(filepath$,0)

'Do While pathname$<>""

	'pathname$=Dir$()

'Loop

'Msgbox pathname$

’ Msgbox filepath$

’ If pathname$<>" " Then

’ Open Excel Application

'End If

’ continue=True

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

Open filepath$ For Output As filenum

Print   filenum

Close filenum

'Dim z As Variant,x As Variant, y As Variant

Set z=createobject("Excel.Application")

z.workbooks.open filepath

z.visible=True

'Set y=z.Workbooks.add	

'z.workbooks.add

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

Dim i As Integer ' taking for column

i=2

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



If Not uidoc Is Nothing Then

	Gosub Export

End If

If uidoc Is Nothing Then

	Gosub Terminate

End If

Close filepath	

’ Export Values from Out Door View

Export :

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

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

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

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

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

Set y=z.ActiveWorkbook

Call y.SaveAs(filepath)//ERROR HERE

Call y.close

'z.ActiveWorkbook.Save

z.Quit

Set z=Nothing







'Set y = z.ActiveWorkbook

'Call y.SaveAs(filepath$)

'Call y.close	





'Save the excel file

'Dim cfilename As Variant

'cfilename="c:\temp\exporttoexcel.xls"

    'doc.Excelpath(0)

'Msgbox cfilename

        ' "c:\temp\exporttoexcel.xls"

’ If Dir(fileName$)<>“” Then

’ End If

Terminate :

Exit Sub

Errorhandle:

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

THANKS AND REGARDS

Subject: Urgent please :Cannot access the file name

Please read the forum etiquette section and stop posting the same question over and over again

Subject: RE: Urgent please :Cannot access the file name

Thank you i will not do this mistake again.

thanks&regards