Menu created with Macro How to CALL THE MACRO?

Libra office 25.2.2.2
Calc
Macros
AI just wrote this and it partially works

Doesn’t want to exercise the Macro
(with the quotes off it just calls it right away)

Sub CreateMenu()
GlobalScope.BasicLibraries.loadLibrary(“ScriptForge”)
Dim oDoc as Object, oMenu as Object
Set oDoc = CreateScriptService(“Document”)
Set oMenu = oDoc.CreateMenu(“My Menu”)
With oMenu
.AddItem(“goto Circle”, Command := “gotoCircle”)
'.AddItem(“goto Macros”, Script := “vnd.sun.star.script:Standard.Module1.ItemB_Listener?language=Basic&location=application”)
.Dispose()
End With
End Sub

Sub gotoCircle
dim document as object
dim dispatcher as object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService(“com.sun.star.frame.DispatchHelper”)
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = “Nr”
args2(0).Value = 2
dispatcher.executeDispatch(document, “.uno:JumpToTable”, “”, 0, args2())
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = “ToPoint”
args3(0).Value = “$D$6”
dispatcher.executeDispatch(document, “.uno:GoToCell”, “”, 0, args3())
End Sub

Blockquote

:thinking:

???/
not sure what your saying.

these are two menu creators I found. both make the menu, but neither exercises the menu item request when you push it

from how many iterations ? :thinking:

maybe readers here, from whom you probably expect answers, would deserve a more explanatory prompt ? :wink:

in essence Ask/Guide - How to use the Ask site - The Document Foundation Wiki #More_details

at least, have your messages easily readable wouldn’t hurt.

on your “question”, maybe see LibreOffice Developer's Guide: Chapter 11 - LibreOffice Basic - The Document Foundation Wiki #Application_Library_Container

1 Like

iterations of what?

what do you mean by a prompt?

i’m not a programmer

ask it to make a menu that works

per your request :