I figured it out. The reason why it didn't work properly was because the macro didn't like the file name 'New Folder'. In particular, it did not like the space between 'New' and 'Folder' for some reason. I know this because when I changed the name of that folder to just 'folder' 9one word with no spaces) it worked.
dalex,
you can also call Excel as OLE, and enjoy added functionality.
This snippet opens strfilename, removes the top 7 rows, autofits the width of column A and adds a title in bold on the top row, prior to saving in Excel 2000 format.
Dim objExcel as Object
....
Set objExcel = CreateObject("Excel.Application"
objExcel.Visible = 1
objExcel.Application.Workbooks.Open strfilename
objExcel.Application.DisplayAlerts = False
objExcel.Rows("1:7".Select
objExcel.Selection.Delete shift:=xlup
objExcel.Columns("A:AA".Select
objExcel.Columns("A:AA".EntireColumn.AutoFit
objExcel.Range("A1".Select
objExcel.ActiveCell.FormulaR1C1 = "Target Customer results to period just ended"
objExcel.Range("A1".Select
objExcel.Selection.Font.Bold = True
objExcel.Application.Workbooks(1).SaveAs strfilename, Fileformat:=-4143
objExcel.Application.Workbooks(1).Close
objExcel.Application.Quit
I suppose that if you add some " it should be able to open the file .
shell ("C:\Program files\Microsoft Office\Office10\excel.exe" /Y "Y:Temp\New folder\testa1.xls"
You guys are terrific! Thanks for your assistance.
P.S. Is there anything "cool" that can be done with Cognos script editor? I mean like a progress bar or something? Really anything that might add a cherry on top.
It's no big deal because I have everything working; just thought I'd ask.
I know that you don't need your original question answering now that you have a solution for the Excel problem but to open up a batch file you use the following command
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.