Spikenaylor
Board Regular
- Joined
- Apr 14, 2013
- Messages
- 116
- Office Version
- 365
- Platform
- Windows
Hi there,
I am using data validation linked to a list in another workbook, both need to be open in the same instance of excel and everything works fine.
The source spreadsheet opens up and is hidden as noone needs to see it.
I can save my spreadsheet that I am entering data on , but then want to close both workbooks together when clicking X
however only my data entry spreqdsheet closes and it asks me if I want to save the other workbook before closing.
i have tried various methods but unsucessfuly.
Can anyone provide a clue..
Many thanks in advance
code is shown
I am using data validation linked to a list in another workbook, both need to be open in the same instance of excel and everything works fine.
The source spreadsheet opens up and is hidden as noone needs to see it.
I can save my spreadsheet that I am entering data on , but then want to close both workbooks together when clicking X
however only my data entry spreqdsheet closes and it asks me if I want to save the other workbook before closing.
i have tried various methods but unsucessfuly.
Can anyone provide a clue..
Many thanks in advance
code is shown
Code:
Private Sub Workbook_Open() 'opens automatically with your Excel file
Application.ScreenUpdating = False
Workbooks.Open Filename:="F:\Controlled Systems\Main Strain List\Strains Spreadsheet.xlsx", UpdateLinks:=True, ReadOnly:=True
ActiveWindow.Visible = False
Application.ScreenUpdating = True
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
' I need to get a command here to close the Strains Spreadsheet with out saving.
Application.ScreenUpdating = False
Workbooks.Close("F:\Controlled Systems\Main Strain List\Strains Spreadsheet.xlsx").Saved = False ' this not working
Workbooks("F:\Controlled Systems\Main Strain List\Strains Spreadsheet.xlsx").Close = True ' this not working
Application.ScreenUpdating = True
End Sub