Private Sub Workbook_Open()
If Not Application.Version >= "14.0" Then
MsgBox ("Installare Excel 2010 o successivo!")
ThisWorkbook.Close SaveChanges:=False
Application.DisplayAlerts = False
Exit Sub
End If
Dim book As New Excel.Workbook
Application.ScreenUpdating = False
Application.ThisWorkbook.UpdateLinks = xlUpdateLinksNever
Application.ThisWorkbook.UpdateRemoteReferences = False
On Error Resume Next
Application.DisplayAlerts = False
If Dir$("H:PREVENTIVI2013MODELLO PREVENTIVODATAtest.xls") <> "" Then
Set book = Workbooks.Open("H:PREVENTIVI2013MODELLO PREVENTIVODATAtest.xls", UpdateLinks:=False, ReadOnly:=False)
Application.DisplayAlerts = True
MsgBox ("ATTENZIONE!! Le versioni precedenti alla 8.12 presentano un ERRORE DI CALCOLO della posa!")
Else
MsgBox "Impossibile aprire il database."
Dim intChoice As Integer
Dim strPath As String
Application.FileDialog(msoFileDialogOpen).AllowMultiSelect = False
Call Application.FileDialog(msoFileDialogOpen).Filters.Clear
Call Application.FileDialog(msoFileDialogOpen).Filters.Add("File di Excel", "*.xls")
'Call Application.FileDialog(msoFileDialogOpen).Filters.Add("Text Files Only", "*.txt")
'make the file dialog visible to the user
intChoice = Application.FileDialog(msoFileDialogOpen).Show
'determine what choice the user made
If intChoice <> 0 Then
'get the file path selected by the user
strPath = Application.FileDialog(msoFileDialogOpen).SelectedItems(1)
End If
Set book = Workbooks.Open(strPath, UpdateLinks:=False, ReadOnly:=False)
If book <> False Then
If Err = 0 Then
If Right(spath, 1) <> "" Then
spath = spath & ""
End If
End If
End If
End If
End Sub |