??? no capisco niente di quello che hai scritto
ti posto il codice
cmq vada
codice:Public Sub aprifile() Dim FileNum As Integer Dim FileTitle As String Dim FileName As String On Error Resume Next Dim intDomINSP As Integer 'Variabile di MsgBox 'If FrmSP.boolVerifica10 = False And Ctr(FrmSP.Txt105SP.Text) > 0 Then ' chiede di salvare o No ' intDomINSP = MsgBox("SP - Volete salvare il file ? Clic su OK per effettuare" & Chr(13) _ ' & "l'operazione - su Annulla per aprire un nuovo file, senza salvare quello in uso.", vbExclamation + vbOKCancel, "Applicazioni Aziendali") ' If intDomINSP = 1 Then 'Pulsante OK ' Call SalvaSP 'Invia alla routine salva con nome ' End If 'End If 'Variabili per Aprire il file: With MDIForm1.CommonDialog1 .CancelError = True 'Imposta CancelError su True On Error GoTo ErrHandler .Filter = "Discorsi interni (*.dsi)|*.dsi|Discorsi esterni (*.dse)|" .FilterIndex = 1 .DefaultExt = "dsi" .FLAGS = cdlOFNNoChangeDir Or cdlOFNHideReadOnly Or cdlOFNFileMustExist Or cdlOFNNoReadOnlyReturn .DialogTitle = "Selezionare il file da aprire" .InitDir = app.Path & "\save" .ShowOpen .FileName = MDIForm1.CommonDialog1.FileName ErrHandler: If Err.Number = 32755 Then 'é stato scelto Annulla boolErrAnnSP2 = True Exit Sub Else: boolErrAnnSP2 = False End If FileName = .FileName FileTitle = .FileTitle 'Visualizza nome e percorso del file in uso nella Barra di stato: MDIForm1.StatusBar1.Panels(1).Text = MDIForm1.CommonDialog1.FileTitle FileNum = FreeFile() 'Esce se l'utente ha fatto clic su annulla If Len(FileName) = 0 Then Exit Sub End If End With 'apre il file estensione = Right(FileName, 3) Open FileName For Input As FileNum Select Case estensione Case Is = "dsi" For k = 0 To 9 Input #FileNum, dati(k).campo8, dati(k).campo2, dati(k).campo3, dati(k).campo4, dati(k).campo5, dati(k).campo7 Next k Call trovanumdiscorso apricode = True frmstampa.Show savecode = True Case Is = "dse" End Select Close #FileNum End Sub

Rispondi quotando