Louisa has attended:
Excel VBA Intro Intermediate course
Excel VBA Advanced course
Setting a workbook variable
I HAVE MANAGED TO RESOLVE THIS PLEASE IGNORE
I have searched far and wide over google and can't find the answer.
I have a variable workbook name.  I am checking with an input box that the workbook is open and then want to use it once it has been open.  I know I could check if it was open but would rather the user (who will usually be me) does it before running the macro.
I get a compile error : type mismatch on the workbook variable when I try to set it.
Thanks in advance.  I am pulling my hair out over this.  I am sure its just something small I am missing but can't figure it out.
Here is the code
Sub InputDash()
dteWorking = Worksheets("date").Range("e14")
strWorking = Format(dteWorking, "dd mmmm")
strPath = ThisWorkbook.Path
strDash = InputBox("Have you saved the latest dashboad and is it open", _
            "Dashboard", "Type Yes or No here")
If strDash = "No" Then
MsgBox ("Make sure latest Dashboard is open before trying again")
Exit Sub
End If
Set wbkDash = ("Dashboard " & strworking & "xlsm")
Workbooks(wbkDash).Worksheets("front sheet").Range("a1").Select
End Sub
I have also tried to set the workbook name as a string and can't get that to work either.
Sub InputDash()
dteWorking = Worksheets("date").Range("e14")
strWorking = Format(dteWorking, "dd mmmm")
strPath = ThisWorkbook.Path
strDashName = ("Dashboard " & strWorking & ".xlsm")
strDash = InputBox("Have you saved the latest dashboad and is it open", _
            "Dashboard", "Type Yes or No here")
If strDash = "No" Then
MsgBox ("Make sure latest Dashboard is open before trying again")
Exit Sub
End If
'Set wbkDash = ("Dashboard 23 November.xlsm")
Workbooks(strDashName).Worksheets("front sheet").Range("a1").Select
End Sub
 
                                                        
					