Cell protect is off.
Sheet protect is off.
Macro works when run as a macro.
Get this error when:
run macro as a function,
macro (replaces, deletes, clears) contents of cell.
Note:When macro DOES NOT (replace, delete, clear) contents of cell, it will run as a function.
Same error on seperate computers:
Windows XP, OOA 4.1.5
Windows 10, OOA portable 4.1.5
FORMULA
Code: Select all
=IF($A$1=B3;(DELETE1());"")
Code: Select all
REM ***** BASIC *****
Option Explicit
sub Main
end sub
function delete1()
rem ----------------------------------------------------------------------
rem define variables
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")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$C$3"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "StringName"
args2(0).Value = "delete"
dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args2())
end function