B
Benjamins via AccessMonster.com
Hi,
Below is the Code that i am working:
Dim objXL As Object, objWkb As Object, objSht As Object
Set objXL = CreateObject("Excel.Application")
Set objWkb = objXL.Workbooks.Open([FileName])
Set objSht = objWkb.Worksheets("Sheet1")
With objSht
'Code to modify the excel file Info
End With
objWkb.SaveAs strTempFile 'Save the Excel file as a Tempoary to prevent
overwriting the orginial file
objWkb.Close savechanges:=False
objXL.Quit
Set qdf = CurrentDb.CreateQueryDef("TempQuery", "SELECT T1.* FROM [Excel 8.
0;HDR=YES;IMEX=1;Database=" & strTempFile & "].[Sheet1$] as T1;")
'Code that work on the query
CurrentDb.QueryDefs.Delete "TempQuery"
Kill strTempFile
Every thing working fine until it reached the Kill strTempFile saying No
perrmission.
Is there anything i have done wrong andhow can i rectify it.
Thanks.
Below is the Code that i am working:
Dim objXL As Object, objWkb As Object, objSht As Object
Set objXL = CreateObject("Excel.Application")
Set objWkb = objXL.Workbooks.Open([FileName])
Set objSht = objWkb.Worksheets("Sheet1")
With objSht
'Code to modify the excel file Info
End With
objWkb.SaveAs strTempFile 'Save the Excel file as a Tempoary to prevent
overwriting the orginial file
objWkb.Close savechanges:=False
objXL.Quit
Set qdf = CurrentDb.CreateQueryDef("TempQuery", "SELECT T1.* FROM [Excel 8.
0;HDR=YES;IMEX=1;Database=" & strTempFile & "].[Sheet1$] as T1;")
'Code that work on the query
CurrentDb.QueryDefs.Delete "TempQuery"
Kill strTempFile
Every thing working fine until it reached the Kill strTempFile saying No
perrmission.
Is there anything i have done wrong andhow can i rectify it.
Thanks.