_david_
01-16-2008, 02:42 AM
Hi,
I want to open in Access a (variable) excel file from a specific directory, say d:\temp
I have written the following code:
Dim xl As Object
currentDir = CurDir
ChDrive ("D")
ChDir ("D:\Temp")
Set xl = CreateObject("Excel.Application")
OpenBoolean = xl.Application.Dialogs(xlDialogOpen).Show
ChDrive (Left(currentDir, 1))
ChDir (currentDir)
However it doesn't seem to work, i get an error at the line "OpenBoolean=xl.."
The error is "application-defined or object-defined error"
i think it may have someting to do with the fact that access doesn't recognize the xlDialogOpen object.
Can anyone tell me how I can solve this?
Many thanks
I want to open in Access a (variable) excel file from a specific directory, say d:\temp
I have written the following code:
Dim xl As Object
currentDir = CurDir
ChDrive ("D")
ChDir ("D:\Temp")
Set xl = CreateObject("Excel.Application")
OpenBoolean = xl.Application.Dialogs(xlDialogOpen).Show
ChDrive (Left(currentDir, 1))
ChDir (currentDir)
However it doesn't seem to work, i get an error at the line "OpenBoolean=xl.."
The error is "application-defined or object-defined error"
i think it may have someting to do with the fact that access doesn't recognize the xlDialogOpen object.
Can anyone tell me how I can solve this?
Many thanks