Good Morning,
Ok, here goes.
I have a .xlt and a .xls that work together. What I would like to do is open the .xls automatically when the .xlt is open. I've been using the following code but have the following problems. I would prefer to NOT open the spreadsheet, but another code won't work (copy & paste---copies cells from xlt and pastes to xls) if the xls isn't open.
CODE: (In the Open Event)
Workbooks.Open "T:All_NHSOperatorLBPBackUp.xls"
Workbooks(LBP1).Activate***which is really LBP but when it begins use, it becomes LBP1
ERROR/PROBLEMS:
The .xls opens and returns to the .xlt and immediatley the spreadsheet wants to be saved (I have the following code for that below) but if I cancel I get "subscript out of range" error msg. If I select end twice, it goes away....but I don't have my user forms that I should have.
SAVE CODE:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim strPath As String
Dim strFileName As String
If InStr(ThisWorkbook.FullName, "") = 0 Then
strPath = "T:All_NHSOperator"
strFileName = ThisWorkbook.Worksheets("PatientInfo").Range("G1") & Format(Date, "yyyymmdd") & ThisWorkbook.Worksheets("PatientInfo").Range("H1") & ".xls"
Application.Dialogs(xlDialogSaveAs).Show strPath & strFileName
End If
End Sub
Does anyone have any suggestions on how to bypass this issue...better yet....does anyone understand my ramblings?
Thanks,



