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 <
renatoferrari@tiscali.it> 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: renatoferrari@tiscali.it
email: renatomari.ferra@tiscali.it
posta certificata: renatomaria.ferrari.dogm@pec.mi.omceo.it
--
Linux Registered User #219791
Linux Registered Machine #104061
--
Come cancellarsi: E-mail users+unsubscribe@it.libreoffice.org
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 users+unsubscribe@it.libreoffice.org
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
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.