| | Post: 2 | Registrato il: 25/02/2017
| Utente Junior | 2016 | | OFFLINE | |
|
25/02/2017 21:36 | |
salve,
potreste modificarmi questa macro che salva in pdf un foglio excel nella cartella "D:\Dropbox\" dando come titolo file il dato inserito nella cella "C7"
la macro salva il foglio solo se nella cella C7 c é un numero ma io vorrei che salvi in pdf inserendo un nome e non un numero nella cella C7
cosa devo modificare?
scusate ma sono un pochino inesperto.
grazie a tutti
Sub SalvaPdf()
Dim nf As String
nf = Str(Cells(7, 3))
Range("C7").Select
ActiveCell.FormulaR1C1 = nf
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"D:\Dropbox\" & nf & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
True
End Sub |
|
| | Post: 2.832 | Registrato il: 21/06/2013
| Città: NAPOLI | Età: 70 | Utente Veteran | Excel 365 | | OFFLINE |
|
25/02/2017 23:01 | |
Ciao Michele
Non so se ho capito bene nè ho capito la tua macro ma se in C7 c'è la stringa "Pippo" il file sarà "Pippo.pdf".
Questa macro fa appunto questo.
Sub SalvaPdf()
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"D:\Dropbox\" & Range("c7").Value & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
True
End Sub
Alfredo |
| | Post: 2 | Registrato il: 25/02/2017
| Utente Junior | 2016 | | OFFLINE | |
|
25/02/2017 23:14 | |
Ciao Alfredo,
è esattamente quello che volevo, con la macro di prima riuscivo a salvare solo se nella cella c'era un numero adesso posso salvare anche impostando un nome.
ti ringrazio sei stato molto gentile
|
| | Post: 3 | Registrato il: 25/02/2017
| Utente Junior | 2016 | | OFFLINE | |
|
27/02/2017 11:26 | |
Gentile Alfredo,
posso chiederti ancora un aiuto per migliorare ancora la tua macro?
con questo codice che mi hai dato posso salvare il file con il nome che c'è nella cella C7:
Sub SalvaPdf()
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"D:\Dropbox\" & Range("c7").Value & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
True
End Sub
adesso vorrei chiederti di modificarla per salvare il file con il nome di 2 celle ossia:
cella C7 stringa PIPPO
cella C8 stringa 12345
vorrei salvare il pdf con 12345_PIPPO con underscore tra i due dati, è possibile?
grazie in anticipo |
| | Post: 2.836 | Registrato il: 21/06/2013
| Città: NAPOLI | Età: 70 | Utente Veteran | Excel 365 | | OFFLINE |
|
27/02/2017 12:09 | |
Prova così
vb Sub SalvaPdf()
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"D:\Dropbox\" & Range("c8").Value & "_" & Range("C7").Value & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
True
End Sub
Alfredo |
| | Post: 4 | Registrato il: 25/02/2017
| Utente Junior | 2016 | | OFFLINE | |
|
27/02/2017 12:24 | |
è perfetta Alfredo,
grazie
|
| | Post: 0 | Registrato il: 27/01/2019
| Città: MILANO | Età: 68 | Utente Junior | 2016 | | OFFLINE | |
|
27/01/2019 12:31 | |
Salvare foglio excel in pdf con macro Salve
ho provato ad utilizzare la macro descritta mi da "Errore durante la Stampa" e in debug mi evidenzia in giallo tutte le righe della routine. Cosa sbaglio?
Grazie
[Modificato da RL55 27/01/2019 12:32] |
|
|