Proviamo così:
Ipotizziamo che in A1 ci sia il valore che sarà preso come nome del foglio
e, di conseguenza, dell'intestazione di stampa.
Sub RenameSheetToA1
Dim oSheet As Object
Dim sName As String
' Get the active sheet
oSheet = ThisComponent.CurrentController.ActiveSheet
' Get the string value from cell A1
sName = oSheet.getCellRangeByName("A1").String
' Check if A1 is not empty to avoid errors
If sName <> "" Then
On Error GoTo ErrorHandler ' Handle cases where name already exists
or contains invalid characters
oSheet.Name = sName
Exit Sub
Else
MsgBox "Cell A1 is empty. Please enter a name first."
End If
Exit Sub
ErrorHandler:
MsgBox "Could not rename sheet. Possible reasons:" & Chr(13) & _
"- A sheet with this name already exists" & Chr(13) & _
"- The name contains invalid characters (e.g., : \ / ? * [ ])" &
Chr(13) & _
"- The name is too long (31 characters max)"
End Sub
Fammi sapere.
Ciao
Il giorno ven 12 dic 2025 alle ore 12:17 Ferrari Renato Maria <
[email protected]> ha scritto:
> Il 11/12/25 21:13, Carlo Magistrelli ha scritto:
> > Ciao.
> > Potresti usare una macro che cambia il nome del foglio con il contenuto
> di
> > quella determinata cella;
> > la stampa recepirà quella modifica.
> > Ho 'fatto' la macro con Google AI Studio; non so se è ammesso fornire le
> > istruzioni in
> > questa mailing list.
> > Ciao
> Che io sappia, sì; grazie, comunque se puoi mandamela in privato.
>
> --
> Ferrari Renato Maria
> email: [email protected]
> email: [email protected]
> posta certificata: [email protected]
> --
> Linux Registered User #219791
> Linux Registered Machine #104061
>
>
> --
> Come cancellarsi: E-mail [email protected]
> Problemi?
> https://it.libreoffice.org/supporto/mailing-lists/come-cancellarsi/
> Linee guida per postare + altro:
> https://wiki.documentfoundation.org/Local_Mailing_Lists/it
> Archivio della lista: https://listarchives.libreoffice.org/it/users/
> Privacy Policy: https://www.documentfoundation.org/privacy
>
--
Come cancellarsi: E-mail [email protected]
Problemi? https://it.libreoffice.org/supporto/mailing-lists/come-cancellarsi/
Linee guida per postare + altro:
https://wiki.documentfoundation.org/Local_Mailing_Lists/it
Archivio della lista: https://listarchives.libreoffice.org/it/users/
Privacy Policy: https://www.documentfoundation.org/privacy