Una famiglia di software per fogli di calcolo Microsoft con strumenti per l'analisi, la creazione di grafici e la comunicazione dei dati.
Ciao Giovanni,
Mi dispiace ma non trovo il commento
Unfortunatly it doesn't work as expected
Can you please post only the changes if possible? Then I'll arrange the correct position.
molto informativo.
Tuttavia, forse prova la seguente leggera modifica della tua procedura originale:
'========>>
Option Explicit
'-------->>
Private Sub ExportWorksheets(ByVal WorksheetName As String, ByVal Export_Option As Integer)
On Error GoTo Errhandler
Dim wb As Workbook
Dim ws As Worksheet
Dim fileExtension As String
Dim fileTypeValue As Integer
Const FolderPath As String = "C:\Users\Giovanni\Documents" '<<=== Modifica
fileExtension = Choose(Export\_Option + 1, ".xlsx", ".xls", ".csv", ".pdf")
fileTypeValue = Choose(Export\_Option + 1, 51, 56, 6, 999)
Set wb = ActiveWorkbook
Set ws = wb.Worksheets(WorksheetName)
ws.Copy
If fileTypeValue <> 999 Then
Application.DisplayAlerts = False
wb.Sheets(1).UsedRange.Cells.Copy
ActiveSheet.Cells(1).PasteSpecial xlPasteValues
Application.CutCopyMode = False
ActiveWorkbook.SaveAs Filename:=FolderPath & "\" & WorksheetName & fileExtension, FileFormat:=fileTypeValue
ActiveWorkbook.Close False
Application.DisplayAlerts = True
Else
ws.ExportAsFixedFormat \_
Type:=xlTypePDF, \_
Filename:=FolderPath & "\" & WorksheetName & fileExtension, \_
quality:=xlQualityStandard, \_
includeDocProperties:=True, \_
ignorePrintAreas:=False, \_
openafterPublish:=False
ActiveWorkbook.Close False
End If
CleanObj:
Set ws = Nothing
Set wb = Nothing
Exit Sub
Errhandler:
MsgBox "Si è verificato un errore: " & Err.Number & " " & Err.Description
End Sub
'<<========
===
Regards,
Norman