Hello Guys,
I have little stuck in macro
My macro running successfully but after that I have some function that I need to apply in the macro (I didn’t know so much knowledge of programming but I am learning)
last time I also stuck but then i got answer from you macro ninja
let me explain what is an issue
as per I told you my macro is running successfully , only functions are not working
Macro is in one file (Its not in libreoffice library) that means If I want to use macro in any PC then I could.
this is macro code
Sub AGImacrofortejet2
Dim oDoc As Object
Dim sUrl As String
Dim Prop(1) as New com.sun.star.beans.PropertyValue
Pro
p(0).name="FilterName"
Prop(0).value="Text - txt - csv (StarCalc)"
Prop(1).name="FilterOptions"
Prop(1).value="59/9,34,0,1,1/1/1/1/1/1/1/1"
sUrl = convertToURL("D:\abc\xyz\Artikelliste.csv")
if fileExists(sUrl) then
oDoc = stardesktop.LoadComponentFromURL(sUrl, "_blank",0, Prop())
else
msgbox "Not found"
end if
dim document as object
dim dispatcher as object
document = oDoc.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 = "abc_source"
dispatcher.executeDispatch(document, ".uno:RenameTable", "", 0, args1())
above code is working fine
Now this code is not working I mean Its not getting error but Its not performing operation
sub filter_ON_Quantity()
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
Dim xRange as object
Dim FilterDesc as Object
Dim FilterFields(1) as new com.sun.star.sheet.TableFilterField
Dim data_da
Dim data_a
xRange = thiscomponent.getcurrentcontroller.activesheet.getCellRangeByName("C1:C60000")
FilterDesc = xRange.createFilterDescriptor(true)
FilterDesc.ContainsHeader = true
FilterFields(0).Field = 0
FilterFields(0).IsNumeric = false
FilterFields(0).Operator = com.sun.star.sheet.FilterOperator.EQUAL
FilterFields(0).StringValue = "0"
FilterDesc.SetFilterFields(FilterFields)
xRange.Filter(FilterDesc)
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$C$2"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "By"
args2(0).Value = 1
dispatcher.executeDispatch(document, ".uno:GoDownToEndOfDataSel", "", 0, args2())
dispatcher.executeDispatch(document, ".uno:DeleteRows", "", 0, Array())
End sub
above code is regarding filter , that remove data which has data 0
but its not performing , In my Pc its running successfully but there macro is stored in “My Macros & Dialogs”
and this macro is stored in one ods file (I am just thinking probably error could be this line I am not professional programmer but I just wonder
document = ThisComponent.CurrentController.Frame
I hope you could get my point
Thank you