Cosa significa "così non va"?
Il mio procedimento è questo:
codice:
Option Explicit
Dim FileExcel As Workbook
Dim FoglioExcel As Worksheets
Public Function VerifyFile(FileName As String)
On Error Resume Next
Open FileName For Input As #1
If Err Then
VerifyFile = False
Exit Function
End If
Close #1
VerifyFile = True
End Function
Private Sub Form_Load()
On Error Resume Next
If VerifyFile(gsUserDocumentexcel & "\Esempio.xls") Then
Set FileExcel = Excel.Workbooks.Open(gsUserDocumentexcel & "\Esempio.xls")
Else
MsgBox "Impossibile eseguire il programma" & _
vbCrLf & "Il file " & gsUserDocumentexcel & "\Esempio.xls" & " non Ë stato trovato.", vbOKOnly
End
End If
Set FoglioExcel = FileExcel.Worksheets("Sheet1")
------Istruzioni-------
Set FoglioExcel = Nothing
Set FileExcel = Nothing
End Sub
Cosa non va bene???