Protected cells cannot be modified.

Discuss the spreadsheet application
Locked
ljbaney
Posts: 5
Joined: Sat Feb 09, 2019 6:11 pm

Protected cells cannot be modified.

Post by ljbaney »

File attached.
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
=IF($A$1=B3;(DELETE1());"")

MACRO
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
Attachments
test.ods
(10.76 KiB) Downloaded 76 times
Linda Baney, Apache OpenOffice Portable 4.1.5, Windows 10
Locked