fiordhraoi
MIS
Hey all,
Hopefully this hasn't been answered already, I wasn't able to find anything by searching.
I have the following code in order to have a user be able to select a file for importing into the database.
----------
Public Function GetFile()
GetFileWorked = 0
Dim fDialog As Office.FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.AllowMultiSelect = False
.Title = "Please select the file to import."
.Filters.Clear
.Filters.Add "Microsoft Excel File", "*.xls"
If .Show = True Then
For Each varFile In .SelectedItems
Dim ReversedString As String, FirstFind As Integer
ReversedString = StrReverse(varFile)
FirstFind = InStr(ReversedString, "\") - 1
FileName = StrReverse(Mid(ReversedString, 1, FirstFind))
Next
GetFileWorked = 1
Else
MsgBox ("You either hit Cancel or did not select a file. Please try again.")
GetFileWorked = 0
End If
End With
End Function
-----------
Now, I have the Office 11 object library available in my references, so that worked fine while I was making the DB, and it tested fine on my computer and my co-worker's computer.
Unfortunately, when a different co-worker attempted to use the import function, it failed saying that it was using an invalid reference. I assume this is because he is using Access 2000, and only has the Office 9 object library.
Is there any way to either make the Office 11 object library available to Access 2000 (I already tried copying the file and selecting "browse" under the Tools->References in the VB editor window). Failing that, how can I make this code compatible with both versions?
Thanks all!
Hopefully this hasn't been answered already, I wasn't able to find anything by searching.
I have the following code in order to have a user be able to select a file for importing into the database.
----------
Public Function GetFile()
GetFileWorked = 0
Dim fDialog As Office.FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.AllowMultiSelect = False
.Title = "Please select the file to import."
.Filters.Clear
.Filters.Add "Microsoft Excel File", "*.xls"
If .Show = True Then
For Each varFile In .SelectedItems
Dim ReversedString As String, FirstFind As Integer
ReversedString = StrReverse(varFile)
FirstFind = InStr(ReversedString, "\") - 1
FileName = StrReverse(Mid(ReversedString, 1, FirstFind))
Next
GetFileWorked = 1
Else
MsgBox ("You either hit Cancel or did not select a file. Please try again.")
GetFileWorked = 0
End If
End With
End Function
-----------
Now, I have the Office 11 object library available in my references, so that worked fine while I was making the DB, and it tested fine on my computer and my co-worker's computer.
Unfortunately, when a different co-worker attempted to use the import function, it failed saying that it was using an invalid reference. I assume this is because he is using Access 2000, and only has the Office 9 object library.
Is there any way to either make the Office 11 object library available to Access 2000 (I already tried copying the file and selecting "browse" under the Tools->References in the VB editor window). Failing that, how can I make this code compatible with both versions?
Thanks all!