cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Export excell files using batch program

sgonthey
Super Contributor

Hi,

I 've got some  saved requets using to export in excell format. I want  to do these exports every night using a  batch program.

I know how to connect to my database , open my documents, but I don't know how to rewrite them executing the request and save the file.Does someone can help me?

Thanks a lot !

Sandrine

3 Replies

your welcome sandrine, if you have more issues just let me know.

 

Regards

 

stijn

Thanks  a lot for your help

SVanSchoonlandt
Honored Contributor

Set xlApp = CreateObject("Excel.Application")
Set oWorkBook = xlApp.Workbooks.add
Set oSheet = oWorkBook.WorkSheets(1)

strFileName = "C:\Temp\" &  mgobjSource.GetProp("Short Name") & ".xlsx"
i = 1
oSheet.Cells(i,1).Value = <header column1>

oSheet.Cells(i,2).Value = <header column2>
i = i + 1

set colType = mgobjSource.GetCollection("<metaclass>")

    for each oType in colType
      oSheet.Cells(i,1).Value = oType.GetProp("<attribute1>")
   oSheet.Cells(i,2).Value = oType.GetProp("<attribute2>")
   i = i + 1
    next


oWorkBook.SaveAs(strFileName)