error 9 - simple code
Rather than "If wb.FullName = path2 or path3 Then Exit Sub"
use "If wb.FullName = path2 or wb.fullname = path3 Then Exit Sub"
"PBcorn" wrote:
I omitted to mention that i had added an "or" as follows:
If wb.FullName = path2 or path3 Then Exit Sub
which seems to cause the problem. using two if statments is not a solution
as obviously the exit sub of the first negates the second.
I could just write two subs but is there a better way?
"PBcorn" wrote:
to open a workbook if it is not already open:
dim path as string
path = " letter:\...\\workbook.xls"
If Workbooks(path).IsOpen = False Then
workbooks.open filename:=path
Gives subscript out of range. The solutions i found by searching the forum
are a bit long-winded - why doesn't the above work?
|