Hi,
I have the below code that is working for most of my users but is crashing in the red line for some of the users. The only common trend I've found for those that this is not working is that they are Excel 2013 users as everyone else is Excel 2010. The Excel 2013 users have a run-time error 1004: "Method Open of object Workbooks failed". I honestly don't have a clue of what's making this error show up only for these users. Could you please try to help me?
Many thanks!
I have the below code that is working for most of my users but is crashing in the red line for some of the users. The only common trend I've found for those that this is not working is that they are Excel 2013 users as everyone else is Excel 2010. The Excel 2013 users have a run-time error 1004: "Method Open of object Workbooks failed". I honestly don't have a clue of what's making this error show up only for these users. Could you please try to help me?
Many thanks!
Code:
[COLOR=#333333]Dim SoH As Workbook
Dim Sheet As Worksheet
Dim filedialog1 As FileDialog
Dim dialogtitle As String
Dim chosenfile As String
MsgBox "Choose the most recent report.", vbExclamation
dialogtitle = "Choose the most recent report."
Set filedialog1 = Application.FileDialog(msoFileDialogFilePicker)
With filedialog1
.InitialFileName = "\\Ukpshnsnp001a\"
.AllowMultiSelect = False
.Filters.Clear
.Title = dialogtitle
If filedialog1.Show = False Then
MsgBox "No file was selected. Please try again.", vbCritical, "Erro"
Exit Sub
End If
chosenfile = .SelectedItems(1)
End With
[/COLOR][COLOR=#b22222][B]Set SoH = Workbooks.Open(Filename:=chosenfile)[/B][/COLOR][COLOR=#333333]
Set Sheet = SoH.Worksheets("Sheet1")[/COLOR]