1 Line Needed - Delete Row 1 From Excel

dvent

Registered User.
Local time
Today, 22:24
Joined
Jul 14, 2009
Messages
40
Hi All,

I have written a routine to import some excel sheets into Access. This is tailored from another script I use so I know it works. For this particular workbook however I need to delete the first row of data before it is imported. Can anyone help me with adding this line in?

Thanks in advance
Dvent

Code:
Sub ImportStatusReports()
 
Application.DoCmd.SetWarnings (False)
 
Dim fDialog As Office.FileDialog, excelPath As String
Dim nFile As String
 
MsgBox ("Select your Status Report extract...)")
 
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.AllowMultiSelect = False
.Title = "Select Extract"
If .Show = True Then
excelPath = fDialog.SelectedItems(1)
      
      Else
         MsgBox "No file selected."
         Exit Sub
      End If

   End With
 
' Clear MasterData Table
Application.DoCmd.OpenQuery ("GP_DeleteStatusReports")
 
' Import Excel File (Selected earlier)
 
Excel.Workbooks.Open excelPath
 
[COLOR=red][B]DELETE ROW 1[/B][/COLOR]
 
Excel.ActiveWorkbook.Save
Excel.ActiveWorkbook.Close
 
Application.DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "GP_StatusReportComments", excelPath, True
Application.DoCmd.SetWarnings True
 
Within Excel it would be something like

Worksheets("sheet1").Rows(1).Delete

Brian
 

Users who are viewing this thread

Back
Top Bottom