R
ranswrt
I have the following code:
Sub ReturnToBldrsEst()
Dim wbfilename As String
Call checkworkbook
wbfilename = Worksheets("Current DB").Range("currentwb")
Workbooks(wbfilename).Activate
End Sub
Sub checkworkbook()
Dim wb As Workbook
Dim wbopen As Boolean
Dim wbfilename As String
wbopen = False
wbfilename = Worksheets("Current DB").Range("currentwb")
If wbfilename <> "" Then
For Each wb In Application.Workbooks
If wb.FullName = wbfilename Then
wbopen = True
End If
Next
End If
If wbopen = False Then
Workbooks.Open (wbfilename)
End If
End Sub
On the line with "Workbooks(wbfilename).Activate" I get a script out of
range error. wbfilename =C:\Documents and Settings\Randy\Desktop\Builders
Estimator.xls
What am I doing wrong here?
Thanks
Sub ReturnToBldrsEst()
Dim wbfilename As String
Call checkworkbook
wbfilename = Worksheets("Current DB").Range("currentwb")
Workbooks(wbfilename).Activate
End Sub
Sub checkworkbook()
Dim wb As Workbook
Dim wbopen As Boolean
Dim wbfilename As String
wbopen = False
wbfilename = Worksheets("Current DB").Range("currentwb")
If wbfilename <> "" Then
For Each wb In Application.Workbooks
If wb.FullName = wbfilename Then
wbopen = True
End If
Next
End If
If wbopen = False Then
Workbooks.Open (wbfilename)
End If
End Sub
On the line with "Workbooks(wbfilename).Activate" I get a script out of
range error. wbfilename =C:\Documents and Settings\Randy\Desktop\Builders
Estimator.xls
What am I doing wrong here?
Thanks