Ciao Claudio,
ho predisposto il sotto riportato codice che salva l'immagine con la CD; è un pò ridondante, ma ho preferito inserire alcune possibilità che potrebbero servirti in altre occasioni, e ciò a scapito della sintesi.
codice:
Option Explicit
Dim blErrAnn As Boolean
'----------------------------------------
Private Sub Command1_Click()
'Dim FileNum As Integer
Dim FileName As String
Dim FileTitle As String
With Form1.CommonDialog1
' Imposta CancelError su True:
.CancelError = True
On Error GoTo ErrHandler
.DialogTitle = "Selezionare la destinazione del file"
.Flags = cdlOFNNoChangeDir Or cdlOFNHideReadOnly _
Or cdlOFNPathMustExist Or cdlOFNOverwritePrompt _
Or cdlOFNNoReadOnlyReturn
.Filter = "File di programma (*.jpg)|*.jpg|Altro (*.bmp)|"
.FilterIndex = 1
.DefaultExt = "jpg"
.InitDir = App.Path & "\" & "Immagini\"
.ShowSave
.FileName = .FileName
FileName = Form1.CommonDialog1.FileName
FileTitle = Form1.CommonDialog1.FileTitle
ErrHandler:
' é stato scelto Annulla:
If Err.Number = 32755 Then
' Variabile Boolean eventualmente da utilizzare
' in altra parte del programma:
blErrAnn = True
Exit Sub
End If
'in qusto caso non serve:
'FileNum = FreeFile()
If Len(.FileName) = 0 Then
Exit Sub
End If
End With
' Salva l'immagine inserita nel controllo Picture1:
SavePicture Form1.Picture1, (FileName)
MsgBox "L'immagine" & Space(1) & FileTitle & Space(1) & "è stata salvata con successo!", vbInformation, "Info Img"
End Sub