Ciao David,
Come approcchio diverso, anziche' utilizzare la seconda InputBox, potresti provare qualcosa del genere:
'=========>>
Option Explicit
Public Sub SalvaInPDF()
Dim cPath As String
Dim varNomeFile As Variant
cPath = BrowseFolder("Seleziona una cartella", _
"C:", msoFileDialogViewList)
If cPath = vbNullString Then
Call MsgBox(Prompt:="Hai cancellato la selezione della cartella!", _
Buttons:=vbOKOnly + vbInformation, _
Title:="Uscendo!")
Exit Sub
End If
If Right(cPath, 1) <> Application.PathSeparator Then
cPath = cPath & Application.PathSeparator
End If
varNomeFile = Application.InputBox(Prompt:="Scrivi il nome del file PDF", _
Title:="Nome dal file PDF da salvare", _
Type:=2)
If varNomeFile = False Then Exit Sub
If Len(varNomeFile & vbNullString) = 0 Then Exit Sub
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=cPath & varNomeFile, _
Quality:=xlQualityStandard, _
OpenAfterPublish:=False
End Sub
'--------->>
Public Function BrowseFolder(Title As String, _
Optional InitialFolder As String = vbNullString, _
Optional InitialView As Office.MsoFileDialogView = _
msoFileDialogViewList) As String
'\ : http://www.cpearson.com/excel/browsefolder.aspx
Dim V As Variant
Dim InitFolder As String
With Application.FileDialog(msoFileDialogFolderPicker)
.Title = Title
.InitialView = InitialView
If Len(InitialFolder) > 0 Then
If Dir(InitialFolder, vbDirectory) <> vbNullString Then
InitFolder = InitialFolder
If Right(InitFolder, 1) <> "" Then
InitFolder = InitFolder & ""
End If
.InitialFileName = InitFolder
End If
End If
.Show
On Error Resume Next
Err.Clear
V = .SelectedItems(1)
If Err.Number <> 0 Then
V = vbNullString
End If
End With
BrowseFolder = CStr(V)
End Function
'<<=========
===
Regards,
Norman