RawlinsCross
Active Member
- Joined
- Sep 9, 2016
- Messages
- 437
Good day,
I have two spreadsheets with the first opening the second via a pretty standard method (Application.FileDialog(msoFileDialogFilePicker))
Spreadsheet #1
sFile represents the 2nd spreadsheet. On the 2nd spreadsheet, there is small Workbook_Open routine where a variable bAdmin_ is set to False by default. I'd like this to be false when someone opens up the 2nd spreadsheet directly but set to true if the 1st spreadsheet opens up the 2nd.
Spreadsheet #2
Any thoughts?
I have two spreadsheets with the first opening the second via a pretty standard method (Application.FileDialog(msoFileDialogFilePicker))
Spreadsheet #1
VBA Code:
Set fd = Application.FileDialog(msoFileDialogFilePicker)
bExit_ = False
With fd
.Filters.Clear
.ButtonName = "Load Incident"
.Filters.Add "Excel Files", "*.xls?, *.csv", 1
.Title = "Choose your incident report"
.AllowMultiSelect = False
.InitialFileName = sPath
If .Show = True Then
For i = 1 To .SelectedItems.Count
sFile = .SelectedItems(i)
Set mWb = Workbooks.Open(sFile)
Next i
Else
bExit_ = True
Exit Sub
End If
End With
sFile represents the 2nd spreadsheet. On the 2nd spreadsheet, there is small Workbook_Open routine where a variable bAdmin_ is set to False by default. I'd like this to be false when someone opens up the 2nd spreadsheet directly but set to true if the 1st spreadsheet opens up the 2nd.
Spreadsheet #2
VBA Code:
Public Sub Workbook_Open()
bAdmin_ = False
Call WorkbookSetup
ThisWorkbook.Worksheets("Form").Activate
ThisWorkbook.Worksheets("Form").Range("C20").Select
End Sub
Any thoughts?