[AccessD] A2003:Remove first line in CSV/Excel file

MartyConnelly martyconnelly at shaw.ca
Tue Oct 24 12:43:19 CDT 2006


Ooops misread this should work

Sub testexcelsave()
Dim oApp As Excel.Application

Dim ObjXLBook As Excel.Workbooks
Dim sourceWkBkName As String
Dim sNew As String
On Error GoTo ExcelExit
Set oApp = New Excel.Application 'or use createobject latebinding
'sourceWkBkName = oApp.GetOpenFilename("Excel Files(*.xls),*.xls", _
'                 , "WHERE IS YOUR FILE?", "SELECT")
    With oApp
         .Visible = True
         .Workbooks.Open ("C:\Excel\product2.xls")
       
         '.ActiveSheet.Name = "Wisconsin"
           sNew = .ActiveSheet.Name
           With .Worksheets(sNew)
                    .Rows(1).EntireRow.Delete
                End With
        MsgBox .ActiveWorkbook.FullName
       
         '.ActiveSheet.Rows("1:1").EntireRow.Delete
        
         .ActiveWorkbook.SaveCopyAs "C:\excel\product3.xls"
         '.ActiveWorkbook.SaveAs "C:\excel\product3.xls" 'hmm doesn't 
work with Excel 2007
         .ActiveWorkbook.Close SaveChanges:=False

         .Workbooks.Close
     End With



Set ObjXLBook = Nothing
oApp.Quit
Set oApp = Nothing
ExcelExit:
Debug.Print Err.Number & Err.Description
End Sub




Darren DICK wrote:

>Further to my last
> 
>Does anyone have any code that will remove the first line in an Excel doc but
>from Access?
> 
>Many thanks again in advance
> 
>Darren
> 
>
>  _____  
>
>From: Darren DICK [mailto:darrend at nimble.com.au] 
>Sent: Tuesday, 24 October 2006 11:55 PM
>To: 'Access Developers discussion and problem solving'
>Subject: A2003:Rename a file in a folder
>
>
>Hi all
> 
>I have a file that will be always named the same - EG myCoolCSVfile.csv
> 
>It will be dumped into a folder...say C:\MyCoolFolder at random times
> 
>I need some code to Check the C:\myCoolFolder to see if the file
>myCoolCSVfile.csv file exists in the folder - and if it does to rename it to
>YYMMDDHHMMSS.csv
> 
>Where YY = Year MM = Month DD = Day etc etc
> 
>Does anyone have anything that might suit?
> 
>Many thanks in advance
> 
>Darren
>  
>

-- 
Marty Connelly
Victoria, B.C.
Canada




More information about the AccessD mailing list