External VB script used for Excel now for Calc
Posted: Thu Oct 24, 2013 12:49 am
I have a vb script that I run as a daily scheduled task (win XP) for microsoft excel.
The script copies the content of some cells to another document (template that adds layout) and saves it in another folder
I would now like to use the script on another pc with calc ... that does not seem to be so easy
any help would be greatly appreciated.
the script:
The script copies the content of some cells to another document (template that adds layout) and saves it in another folder
I would now like to use the script on another pc with calc ... that does not seem to be so easy
any help would be greatly appreciated.
the script:
Code: Select all
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\A.xls")
Set objWorksheet = objWorkbook.Worksheets("book1")
Set objRange = objWorksheet.Range("A1:A1500")
objRange.Copy
Set objExcel2 = CreateObject("Excel.Application")
Set objWorkbook2 = objExcel2.Workbooks.Open("C:\B.xls")
Set objWorksheet2 = objWorkbook2.Worksheets("Data")
objWorksheet2.Range("A18").Activate
objWorksheet2.Paste
Set objRange = objWorksheet.Range("B1:B1500")
objRange.Copy
Set objWorksheet2 = objWorkbook2.Worksheets("Data")
objWorksheet2.Range("N18").Activate
objWorksheet2.Paste
Set objRange = objWorksheet.Range("A1:B1500")
objRange.Clear
objWorkbook.Save
objWorkbook2.Saveas("C:\C.xls")