Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 788
Default Error 424 - Object Requried

I have a form in MS Excel (Use the VB to create this form) on this form I have
a button that would allow me to browse and pick a file. Once I pick the file
I have another button that would let me import the file into the spread sheet
but I am get this Error 424 - object required.

Can someone help with this?
Code for Browse
Private Sub cmdBrowse_Click()
'Requires reference to Microsoft Office 11.0 Object Library.
Dim fDialog As Office.FileDialog
Dim varFile As Variant
Dim PicFn As String
'Clear listbox contents.
'Me.FileList.RowSource = ""

'Set up the File Dialog.
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
'Allow user to make multiple selections in dialog box
.AllowMultiSelect = False

'Set the title of the dialog box.
.Title = "Please select an Excel or a Text File"
.InitialView = msoFileDialogViewDetails
.ButtonName = "Select a File"
'.InitialFileName = CurrentProject.Path & "\pictures"
'Clear out the current filters, and add our own.
.Filters.Clear
.Filters.Add "Data File", "*.XLS; *.txt"
.Filters.Add "All Files", "*.*"

'Show the dialog box. If the .Show method returns True, the
'user picked at least one file. If the .Show method returns
'False, the user clicked Cancel.
If .Show = True Then
''Loop through each file selected and add it to our list box.
For Each varFile In .SelectedItems
txtInputFile.Value = Format$(varFile)
Next
Dim ExcelApp As Excel.Application
Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.Workbooks.Open txtInputFile.Value
' ExcelApp.Sheets("Sheet1").PrintOut
ExcelApp.Workbooks.Close
Set ExcelApp = Nothing
End If
End With
End Sub
Code for import
'This would import the Current Month Data
Private Sub cmdImport_Click()
On Error GoTo ErrorCheck

varFilename = Me.txtInputFile
If IsNull(varFilename) Then
MsgBox "You must enter an input filename.", vbExclamation, " "
Me.txtInputFile.SetFocus
Exit Sub
End If


DoCmd.TransferText acImportDelim, , "Rate_Table_LIBOR_Swap ",
varFilename, True
Exit Sub

ErrorCheck:
Select Case Err.Number
Case 7874 'Import file not there to delete
Resume Next
Case Else
MsgBox "Error " & Err.Number & " - " & Err.Description
Exit Sub
End Select


'End Sub

Thanks in advance



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Error 424 - Object Requried

Which line is highlighted when you get this error?

--
Regards,
Tom Ogilvy


"Chris" wrote:

I have a form in MS Excel (Use the VB to create this form) on this form I have
a button that would allow me to browse and pick a file. Once I pick the file
I have another button that would let me import the file into the spread sheet
but I am get this Error 424 - object required.

Can someone help with this?
Code for Browse
Private Sub cmdBrowse_Click()
'Requires reference to Microsoft Office 11.0 Object Library.
Dim fDialog As Office.FileDialog
Dim varFile As Variant
Dim PicFn As String
'Clear listbox contents.
'Me.FileList.RowSource = ""

'Set up the File Dialog.
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
'Allow user to make multiple selections in dialog box
.AllowMultiSelect = False

'Set the title of the dialog box.
.Title = "Please select an Excel or a Text File"
.InitialView = msoFileDialogViewDetails
.ButtonName = "Select a File"
'.InitialFileName = CurrentProject.Path & "\pictures"
'Clear out the current filters, and add our own.
.Filters.Clear
.Filters.Add "Data File", "*.XLS; *.txt"
.Filters.Add "All Files", "*.*"

'Show the dialog box. If the .Show method returns True, the
'user picked at least one file. If the .Show method returns
'False, the user clicked Cancel.
If .Show = True Then
''Loop through each file selected and add it to our list box.
For Each varFile In .SelectedItems
txtInputFile.Value = Format$(varFile)
Next
Dim ExcelApp As Excel.Application
Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.Workbooks.Open txtInputFile.Value
' ExcelApp.Sheets("Sheet1").PrintOut
ExcelApp.Workbooks.Close
Set ExcelApp = Nothing
End If
End With
End Sub
Code for import
'This would import the Current Month Data
Private Sub cmdImport_Click()
On Error GoTo ErrorCheck

varFilename = Me.txtInputFile
If IsNull(varFilename) Then
MsgBox "You must enter an input filename.", vbExclamation, " "
Me.txtInputFile.SetFocus
Exit Sub
End If


DoCmd.TransferText acImportDelim, , "Rate_Table_LIBOR_Swap ",
varFilename, True
Exit Sub

ErrorCheck:
Select Case Err.Number
Case 7874 'Import file not there to delete
Resume Next
Case Else
MsgBox "Error " & Err.Number & " - " & Err.Description
Exit Sub
End Select


'End Sub

Thanks in advance



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 788
Default Error 424 - Object Requried

Tom

No line is highlighted I am getting a pop up box with the error message.

Also Tom, Can you help with the error I'm gettimg with my previous ?
"Subject - Application to import and convert Data" I tryied your code but I
am getting some erors still


"Tom Ogilvy" wrote:

Which line is highlighted when you get this error?

--
Regards,
Tom Ogilvy


"Chris" wrote:

I have a form in MS Excel (Use the VB to create this form) on this form I have
a button that would allow me to browse and pick a file. Once I pick the file
I have another button that would let me import the file into the spread sheet
but I am get this Error 424 - object required.

Can someone help with this?
Code for Browse
Private Sub cmdBrowse_Click()
'Requires reference to Microsoft Office 11.0 Object Library.
Dim fDialog As Office.FileDialog
Dim varFile As Variant
Dim PicFn As String
'Clear listbox contents.
'Me.FileList.RowSource = ""

'Set up the File Dialog.
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
'Allow user to make multiple selections in dialog box
.AllowMultiSelect = False

'Set the title of the dialog box.
.Title = "Please select an Excel or a Text File"
.InitialView = msoFileDialogViewDetails
.ButtonName = "Select a File"
'.InitialFileName = CurrentProject.Path & "\pictures"
'Clear out the current filters, and add our own.
.Filters.Clear
.Filters.Add "Data File", "*.XLS; *.txt"
.Filters.Add "All Files", "*.*"

'Show the dialog box. If the .Show method returns True, the
'user picked at least one file. If the .Show method returns
'False, the user clicked Cancel.
If .Show = True Then
''Loop through each file selected and add it to our list box.
For Each varFile In .SelectedItems
txtInputFile.Value = Format$(varFile)
Next
Dim ExcelApp As Excel.Application
Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.Workbooks.Open txtInputFile.Value
' ExcelApp.Sheets("Sheet1").PrintOut
ExcelApp.Workbooks.Close
Set ExcelApp = Nothing
End If
End With
End Sub
Code for import
'This would import the Current Month Data
Private Sub cmdImport_Click()
On Error GoTo ErrorCheck

varFilename = Me.txtInputFile
If IsNull(varFilename) Then
MsgBox "You must enter an input filename.", vbExclamation, " "
Me.txtInputFile.SetFocus
Exit Sub
End If


DoCmd.TransferText acImportDelim, , "Rate_Table_LIBOR_Swap ",
varFilename, True
Exit Sub

ErrorCheck:
Select Case Err.Number
Case 7874 'Import file not there to delete
Resume Next
Case Else
MsgBox "Error " & Err.Number & " - " & Err.Description
Exit Sub
End Select


'End Sub

Thanks in advance



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Error 424 - Object Requried

If you hit the debug button in the popup, then you should be taken to the VBE
and see a line highlighted.

--
Regards,
Tom Ogilvy


"Chris" wrote:

Tom

No line is highlighted I am getting a pop up box with the error message.

Also Tom, Can you help with the error I'm gettimg with my previous ?
"Subject - Application to import and convert Data" I tryied your code but I
am getting some erors still


"Tom Ogilvy" wrote:

Which line is highlighted when you get this error?

--
Regards,
Tom Ogilvy


"Chris" wrote:

I have a form in MS Excel (Use the VB to create this form) on this form I have
a button that would allow me to browse and pick a file. Once I pick the file
I have another button that would let me import the file into the spread sheet
but I am get this Error 424 - object required.

Can someone help with this?
Code for Browse
Private Sub cmdBrowse_Click()
'Requires reference to Microsoft Office 11.0 Object Library.
Dim fDialog As Office.FileDialog
Dim varFile As Variant
Dim PicFn As String
'Clear listbox contents.
'Me.FileList.RowSource = ""

'Set up the File Dialog.
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
'Allow user to make multiple selections in dialog box
.AllowMultiSelect = False

'Set the title of the dialog box.
.Title = "Please select an Excel or a Text File"
.InitialView = msoFileDialogViewDetails
.ButtonName = "Select a File"
'.InitialFileName = CurrentProject.Path & "\pictures"
'Clear out the current filters, and add our own.
.Filters.Clear
.Filters.Add "Data File", "*.XLS; *.txt"
.Filters.Add "All Files", "*.*"

'Show the dialog box. If the .Show method returns True, the
'user picked at least one file. If the .Show method returns
'False, the user clicked Cancel.
If .Show = True Then
''Loop through each file selected and add it to our list box.
For Each varFile In .SelectedItems
txtInputFile.Value = Format$(varFile)
Next
Dim ExcelApp As Excel.Application
Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.Workbooks.Open txtInputFile.Value
' ExcelApp.Sheets("Sheet1").PrintOut
ExcelApp.Workbooks.Close
Set ExcelApp = Nothing
End If
End With
End Sub
Code for import
'This would import the Current Month Data
Private Sub cmdImport_Click()
On Error GoTo ErrorCheck

varFilename = Me.txtInputFile
If IsNull(varFilename) Then
MsgBox "You must enter an input filename.", vbExclamation, " "
Me.txtInputFile.SetFocus
Exit Sub
End If


DoCmd.TransferText acImportDelim, , "Rate_Table_LIBOR_Swap ",
varFilename, True
Exit Sub

ErrorCheck:
Select Case Err.Number
Case 7874 'Import file not there to delete
Resume Next
Case Else
MsgBox "Error " & Err.Number & " - " & Err.Description
Exit Sub
End Select


'End Sub

Thanks in advance



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 788
Default Error 424 - Object Requried

There is not debug button the pop up just has an ok button

"Tom Ogilvy" wrote:

If you hit the debug button in the popup, then you should be taken to the VBE
and see a line highlighted.

--
Regards,
Tom Ogilvy


"Chris" wrote:

Tom

No line is highlighted I am getting a pop up box with the error message.

Also Tom, Can you help with the error I'm gettimg with my previous ?
"Subject - Application to import and convert Data" I tryied your code but I
am getting some erors still


"Tom Ogilvy" wrote:

Which line is highlighted when you get this error?

--
Regards,
Tom Ogilvy


"Chris" wrote:

I have a form in MS Excel (Use the VB to create this form) on this form I have
a button that would allow me to browse and pick a file. Once I pick the file
I have another button that would let me import the file into the spread sheet
but I am get this Error 424 - object required.

Can someone help with this?
Code for Browse
Private Sub cmdBrowse_Click()
'Requires reference to Microsoft Office 11.0 Object Library.
Dim fDialog As Office.FileDialog
Dim varFile As Variant
Dim PicFn As String
'Clear listbox contents.
'Me.FileList.RowSource = ""

'Set up the File Dialog.
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
'Allow user to make multiple selections in dialog box
.AllowMultiSelect = False

'Set the title of the dialog box.
.Title = "Please select an Excel or a Text File"
.InitialView = msoFileDialogViewDetails
.ButtonName = "Select a File"
'.InitialFileName = CurrentProject.Path & "\pictures"
'Clear out the current filters, and add our own.
.Filters.Clear
.Filters.Add "Data File", "*.XLS; *.txt"
.Filters.Add "All Files", "*.*"

'Show the dialog box. If the .Show method returns True, the
'user picked at least one file. If the .Show method returns
'False, the user clicked Cancel.
If .Show = True Then
''Loop through each file selected and add it to our list box.
For Each varFile In .SelectedItems
txtInputFile.Value = Format$(varFile)
Next
Dim ExcelApp As Excel.Application
Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.Workbooks.Open txtInputFile.Value
' ExcelApp.Sheets("Sheet1").PrintOut
ExcelApp.Workbooks.Close
Set ExcelApp = Nothing
End If
End With
End Sub
Code for import
'This would import the Current Month Data
Private Sub cmdImport_Click()
On Error GoTo ErrorCheck

varFilename = Me.txtInputFile
If IsNull(varFilename) Then
MsgBox "You must enter an input filename.", vbExclamation, " "
Me.txtInputFile.SetFocus
Exit Sub
End If


DoCmd.TransferText acImportDelim, , "Rate_Table_LIBOR_Swap ",
varFilename, True
Exit Sub

ErrorCheck:
Select Case Err.Number
Case 7874 'Import file not there to delete
Resume Next
Case Else
MsgBox "Error " & Err.Number & " - " & Err.Description
Exit Sub
End Select


'End Sub

Thanks in advance





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Error 424 - Object Requried

Private Sub cmdImport_Click()
'On Error GoTo ErrorCheck 'comment out this line to see the real error

Tim



"Chris" wrote in message
...
There is not debug button the pop up just has an ok button

"Tom Ogilvy" wrote:

If you hit the debug button in the popup, then you should be taken to the
VBE
and see a line highlighted.

--
Regards,
Tom Ogilvy


"Chris" wrote:

Tom

No line is highlighted I am getting a pop up box with the error
message.

Also Tom, Can you help with the error I'm gettimg with my previous ?
"Subject - Application to import and convert Data" I tryied your code
but I
am getting some erors still


"Tom Ogilvy" wrote:

Which line is highlighted when you get this error?

--
Regards,
Tom Ogilvy


"Chris" wrote:

I have a form in MS Excel (Use the VB to create this form) on this
form I have
a button that would allow me to browse and pick a file. Once I pick
the file
I have another button that would let me import the file into the
spread sheet
but I am get this Error 424 - object required.

Can someone help with this?
Code for Browse
Private Sub cmdBrowse_Click()
'Requires reference to Microsoft Office 11.0 Object Library.
Dim fDialog As Office.FileDialog
Dim varFile As Variant
Dim PicFn As String
'Clear listbox contents.
'Me.FileList.RowSource = ""

'Set up the File Dialog.
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
'Allow user to make multiple selections in dialog box
.AllowMultiSelect = False

'Set the title of the dialog box.
.Title = "Please select an Excel or a Text File"
.InitialView = msoFileDialogViewDetails
.ButtonName = "Select a File"
'.InitialFileName = CurrentProject.Path & "\pictures"
'Clear out the current filters, and add our own.
.Filters.Clear
.Filters.Add "Data File", "*.XLS; *.txt"
.Filters.Add "All Files", "*.*"

'Show the dialog box. If the .Show method returns True, the
'user picked at least one file. If the .Show method returns
'False, the user clicked Cancel.
If .Show = True Then
''Loop through each file selected and add it to our list
box.
For Each varFile In .SelectedItems
txtInputFile.Value = Format$(varFile)
Next
Dim ExcelApp As Excel.Application
Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.Workbooks.Open txtInputFile.Value
' ExcelApp.Sheets("Sheet1").PrintOut
ExcelApp.Workbooks.Close
Set ExcelApp = Nothing
End If
End With
End Sub
Code for import
'This would import the Current Month Data
Private Sub cmdImport_Click()
On Error GoTo ErrorCheck

varFilename = Me.txtInputFile
If IsNull(varFilename) Then
MsgBox "You must enter an input filename.", vbExclamation,
" "
Me.txtInputFile.SetFocus
Exit Sub
End If


DoCmd.TransferText acImportDelim, , "Rate_Table_LIBOR_Swap ",
varFilename, True
Exit Sub

ErrorCheck:
Select Case Err.Number
Case 7874 'Import file not there to delete
Resume Next
Case Else
MsgBox "Error " & Err.Number & " - " & Err.Description
Exit Sub
End Select


'End Sub

Thanks in advance





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
if query2- urgent requried deen Excel Worksheet Functions 1 January 16th 09 04:56 PM
Object Variable Not Set Error on Selection object Jean Excel Worksheet Functions 3 July 24th 06 06:45 PM
Error 1004, Application-definded or object-defined error Mirco Wilhelm[_2_] Excel Programming 9 January 7th 06 04:56 PM
run-time error '1004': Application-defined or object-deifined error [email protected] Excel Programming 5 August 10th 05 09:39 PM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM


All times are GMT +1. The time now is 12:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"