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

Darren DICK darrend at nimble.com.au
Mon Oct 30 18:09:22 CST 2006


Hi Marty

Not sure if I replied or not - it works like a treat - this makes life sooooooo
much easier 

well done and many thanks 

Darren
------------------

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of MartyConnelly
Sent: Wednesday, 25 October 2006 3:43 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] A2003:Remove first line in CSV/Excel file

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

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list