EXCEL MACRO VIA Python

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bodmonkey
    New Member
    • Oct 2006
    • 1

    #1

    EXCEL MACRO VIA Python

    Hi Experts,

    I'm both very new to Python and to VBA, so my question may well be a simple one but i'm tearing my hair out

    Basically i get a different excel files produced in any number after running a certain job and so the file names change for each job.

    I have written a macro via vba to do some sorting and create a presentation in PP.

    Now i want to combine hte 2 processes, but am having real trouble making my macro global and running the macro for each different file

    Any help is much appreciated

    Mike

    Code Below

    import win32com.client
    xl = win32com.client .Dispatch("Exce l.Application")
    ppt = win32com.client .Dispatch("Powe rPoint.Applicat ion")
    xl.Visible = 1 #open MS Excel
    ppt.Visible = 1 #open MS Powerpoint
    xl.Workbooks.Op en('Z:\\project s\\surveys\\SPS S - Generic files\\big output.xls')
    xl.Workbooks.Op en('Z:\\project s\\surveys\\SPS S - Generic files\\ChartsTo Presentation.xl a')
    xl.Application. ExecuteExcel4Ma cro("!PERSONAL. XLS!ChartsToPre sentation")
Working...