Hi there!

I am trying to initialize excel aplication from visual basic and then input some data.BUT im guetting an error (that i guess has to do with my previlegies in the PC).Im working with this language now in my new job,and i have some issues with previlegies there.

HERE IS THE CODE:

Option Compare Database
Dim BD As DAO.Database
Dim content As DAO.Recordset

Private Sub Main()
Const ForReading = 1
Dim fso, fTextFile
Dim linha As String
Dim cod_frn As String
Dim xl As New Excel.Application
Dim xlw As Excel.Workbook

Set fso = CreateObject("Scripting.FileSystemObject")
Set fTextFile = fso.OpenTextFile("P:\codigos.txt", ForReading)

Set BD = OpenDatabase("P:\Access\db1.mdb", False, True)
Set content = BD.OpenRecordset("B8HJ_DADOS_PEDIDO")

While content.EOF = False
While fTextFile.AtEndOfStream <> True
linha = fTextFile.ReadLine
value_table = content("ID_ITEM")
value_table = Replace(value_table, " ", "")

' If linha = value_table Then
'inserir no excel
Set xlw = xl.Workbooks.Add 'HERE I GET THE ERROR MESSAGE "this feature is not available.For more info,contact the system`s admin"
xlw.SaveAs ("P:\teste.xls")
If wb Is Nothing Then
MsgBox ("Não foi possivel abrir o arquivo" + (sFile))
xl.Quit
End If
' End If
Wend
content.MoveNext
fTextFile.Close
Set fTextFile = fso.OpenTextFile("P:\codigos.txt", ForReading)
Wend

MsgBox "FIM"
fTextFile.Close
End Sub


so the error message is "this feature is not available.For more info,contact the system`s admin"

Do you know what kind of error is this?what can i do to fix it?