Its been a while but I need help once again. I am having trouble with the syntax of the above. Scenario is I have a workbook (quoting template) that opens another workbook to print all the relevant documentation. The workbook to open is dependant on what state the user is in. I have a drop down box on the cover sheet where the user selects their state. What I want is if the state "NSW" is selected then the macro opens the required workbook on that server. Please see the part of the macro that is causing me the heartache.
Thanks heaps for taking the time to look at thsi for me.
Private Sub Print_Documents_Click()
Dim wb2 As Workbook
Dim wb1 As Workbook
Dim ws As Worksheet
Dim fPath As String
'Setup
Application.ScreenUpdating = False
Application.DisplayAlerts = False
'Application.Dialogs(xlDialogPrinterSetup).Show
Set wb1 = ThisWorkbook
If wb1.Sheets("TOW Cover Sheet").Range("Y2").Value = "NSW" Then
Workbooks.Open = ("D:\major_Job_packs\Major Job Pack Docs.xlsm")
ElseIf wb1.Sheets("TOW Cover Sheet").Range("Y2").Value = "QLD" Then
Workbooks.Open = ("Q:\Major_Job_Packs\Major Job Pack Docs.xlsm")
ElseIf wb1.Sheets("TOW Cover Sheet").Range("Y2").Value = "VIC" then
Workbooks.Open ("E:\Major_Job_Packs\Major Job Pack Docs.xlsm")
Else
MsgBox "Please select state on cover sheet"
End If
Thanks heaps for taking the time to look at thsi for me.
Private Sub Print_Documents_Click()
Dim wb2 As Workbook
Dim wb1 As Workbook
Dim ws As Worksheet
Dim fPath As String
'Setup
Application.ScreenUpdating = False
Application.DisplayAlerts = False
'Application.Dialogs(xlDialogPrinterSetup).Show
Set wb1 = ThisWorkbook
If wb1.Sheets("TOW Cover Sheet").Range("Y2").Value = "NSW" Then
Workbooks.Open = ("D:\major_Job_packs\Major Job Pack Docs.xlsm")
ElseIf wb1.Sheets("TOW Cover Sheet").Range("Y2").Value = "QLD" Then
Workbooks.Open = ("Q:\Major_Job_Packs\Major Job Pack Docs.xlsm")
ElseIf wb1.Sheets("TOW Cover Sheet").Range("Y2").Value = "VIC" then
Workbooks.Open ("E:\Major_Job_Packs\Major Job Pack Docs.xlsm")
Else
MsgBox "Please select state on cover sheet"
End If