[AccessD] Reports to Excel

Mark A Matte markamatte at hotmail.com
Tue May 1 10:16:01 CDT 2007


Thanks Gustav,

I'didn't really care for what the macro recorder gave.  I found some code 
examples on line...and modified.  Below is what I used.

Thanks,

Mark A. Matte

    With appExcel
        .Workbooks.Open strpathname, 0
        .Visible = True 'just to watch the sheet
        .Range("A1:AC1").Select
        .Selection.Font.Bold = True
        .Selection.Font.Name = "Arial"
        .Selection.Font.Size = 12
        Do Until MyRst.NoMatch
            Counter = Counter + 1
            .Cells(1, Counter) = MyRst!Reas_cd
            If MyRst![View] = 0 Then .Cells(1, Counter).Font.Color = 255
            MyRst.FindNext strSQL
        Loop
        .Columns.AutoFit
        .Rows.AutoFit
        .Columns.Borders.Color = vbBlack
        .ActiveWorkbook.SaveAs FileName:=strpathnew, FileFormat:=xlNormal
    End With
     appExcel.Quit


>From: "Gustav Brock" <Gustav at cactus.dk>
>Reply-To: Access Developers discussion and problem 
>solving<accessd at databaseadvisors.com>
>To: <accessd at databaseadvisors.com>
>Subject: Re: [AccessD] Reports to Excel
>Date: Tue, 01 May 2007 11:07:08 +0200
>
>Hi Mark
>
>You really should clean up the code. Indeed, get rid of all the Selection 
>stuff you do not need (that's most if not all of it) and replace with 
>Ranges - if you don't, your code will look like, well, it has been created 
>by the Macro Recorder!
>
>/gustav
>
> >>> jwcolby at colbyconsulting.com 30-04-2007 22:21 >>>
>
>As Jim mentioned, you might want to clean up the code, but you don't have 
>to.
>
>
>
>--
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com

_________________________________________________________________
MSN is giving away a trip to Vegas to see Elton John.  Enter to win today. 
http://msnconcertcontest.com?icid-nceltontagline




More information about the AccessD mailing list