Hello @Raptor88,
To display Text only for your commandbutton, do:
- Choose the menu “Tools : Customize…”,
- Select the tab “Toolbars”,
- Select the “Formatting” Toolbar ( where your macro button is ),
- In the “Commands” listbox, select your macro button,
- In the option list called “Style”, select “Text”.
For older version:
5, click on the button called “Toolbar”, in the menu that pops up, select the item “Text only”.
`EDIT 2017-07-20`
In order to delete your icon from your macro command, you could try the following approach:
Using the Image Manager from a component’s UIConfigurationManager, you can associate a particular icon with a particular Command such as a Dispatch URI or a macro from your library. This associated icon is then automatically shown whenever that particular Command gets shown in the GUI.
In your case the icon is associated to a Macro, so its Command string would look something like : “vnd.sun.star.script:Library.Module.Macro?language=Basic&location=document”.
To find out which of your macros have an icon associated to them in the current Component, you could inspect the result of getMacroIconNames( 0 )
. If it contains your macro, then you can remove its associated icon by calling removeCommandIcon( 0, <your macro> )
.
NB. this works for the current Office Module ( Base, Writer, Calc, etc ), if you run this macro from another Office Module, it gives different results.
Function getMacroIconNames( iImageType as Integer )
REM Returns an Array with Strings representing all Macros which have an icon associated with them ( From the current Component ).
REM iImageType: Short of type com.sun.star.ui.ImageType. ( 0=Default Size and Normal Contrast; 1=Big Size; 4=High Contrast )
Const sMacroURIHeader As String = "vnd.sun.star.script:"
Dim aMacroIconNames() As String, aAllIconNames() As String, sCommand$, i%
aAllIconNames = getImageManager.getAllImageNames( iImageType )
For i = 0 To uBound( aAllIconNames )
sCommand = aAllIconNames( i )
If Left( sCommand, Len( sMacroURIHeader ) ) = sMacroURIHeader Then
ReDim Preserve aMacroIconNames( uBound( aMacroIconNames ) + 1 )
aMacroIconNames( uBound( aMacroIconNames ) ) = sCommand
End If
Next
getMacroIconNames = aMacroIconNames
End Function
Function getImageManager()
REM Returns the ImageManager for the current Office Module ( Writer, Base, etc ).
Dim oModuleMgr, oModuleCfgMgrSupplier, oModuleIdentifier, oModuleCfgMgr
oModuleMgr = createUnoService( "com.sun.star.frame.ModuleManager" )
oModuleCfgMgrSupplier = createUnoService( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" )
oModuleIdentifier = oModuleMgr.identify( ThisComponent )
oModuleCfgMgr = oModuleCfgMgrSupplier.getUIConfigurationManager( oModuleIdentifier )
getImageManager = oModuleCfgMgr.ImageManager
End Function
Sub removeCommandIcon( iImageType as Integer, strCommand as String )
REM Removes the graphic icon associated with the specified Command.
REM iImageType: Short of type com.sun.star.ui.ImageType. ( 0=Default; 0=Normal; 1=Big; 4=High Contrast )
REM strCommand: URI of a Command that has an associated icon to be removed from it.
On Local Error Resume Next
Dim oImageManager
oImageManager = getImageManager()
oImageManager.removeImages( iImageType, Array( strCommand ) )
oImageManager.store()
End Sub