Hey Guys Can we open more then one file in macro
Actually I want to compare 2 files and then need to set data everyday for 50 files, So manually It’s taking much time
So Is it any way to open 2 files and then compare both data and then it could be generate result file ?
Any help would be appreciate
Currently I am doing using this macro code, but it’s open only one file then make new sheet and then copy data that open file to new sheet then hit some operation and finally generate output file
So let me share here macro code of open file, make new sheet ,and last generate output file
Sub ABCmacro
Dim oDoc As Object
Dim sUrl As String
Dim Prop(1) as New com.sun.star.beans.PropertyValue
Prop(0).name="FilterName"
Prop(0).value="Text - txt - csv (StarCalc)"
Prop(1).name="FilterOptions"
Prop(1).value="59,34,1,1,1/1/1/1/1/1/1/1"
sUrl = convertToURL("D:\Projects\inputfile.csv")
if fileExists(sUrl) then
oDoc = stardesktop.LoadComponentFromURL(sUrl, "_blank",0, Prop())
else
msgbox "Not found"
end if
rem define variables
dim document as object
dim dispatcher as object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Name"
args1(0).Value = "Inputfile"
dispatcher.executeDispatch(document, ".uno:RenameTable", "", 0, args1())
dim args2(1) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Name"
args2(0).Value = "Sheet2"
args2(1).Name = "Index"
args2(1).Value = 1
dispatcher.executeDispatch(document, ".uno:Insert", "", 0, args2())
.
.
.
this is operation code (I am skipping that)
.
.
.
.
.
rem----------Output Coding--------------------------------
Dim Propval(1) as New com.sun.star.beans.PropertyValue
Propval(0).Name = "FilterName"
Propval(0).Value = "Text - txt - csv (StarCalc)"
Propval(1).Name = "FilterOptions"
Propval(1).Value = "44,34,76,1" 'ASCII 59 = ; 34 = "
Doc = ThisComponent
FileName = "D:\\Output_file.csv"
FileURL = convertToURL(FileName)
Doc.StoreAsURL(FileURL, Propval())
ThisComponent.CurrentController.Frame.Close(False)
Now anybody got any idea that how to open 2 files instead of one