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:
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")
Last edited by PBlan on Thu Oct 24, 2013 12:28 pm, edited 1 time in total.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
thanks
The last line (Doc2.storeAsURL(NewfileName, Array())) is however generating an error "cannot use parenteses when calling a sub"
As it is the last line that generates the error I expected to see the data copied & the C.ods created but that is not happeng either ...yet
The macro works for me. How exactly are you running it? I've never encountered that error before and in OOBasic you do use parentheses when calling a sub, so I'm puzzled.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
I wrote the macro as OOBasic code, so running the script in VB is very unlikely to work. There is a web site that gives tips on writing VB code that deals with OpenOffice. I think it would be fairly easy to translate the code I posted to VB, but I've hardly ever used that language.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
I looked at the website but writing the code from scratch to run the script in VB is too difficult for me, I would need some examples of code that do something similar, unfortunately I have not been able to find any.
Is there a part of the forum that I could re-direct this post to?
thanks for your help
Set oSM = CreateObject("com.sun.star.ServiceManager")
...
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice