Help with function

A

Albert Browne

Hi.

I am using this call to a function to check if the workbook is open. In a
number of forms this works correctly.
In one form the function is not called. Looking in debug with a breakpoint
on the first line the code then jumps to line three without going to the
function. Can anyone suggest why this may be happening?


If WorkbookIsOpen("Ongoing") = False Then
Set wb = Workbooks.Open(ActiveWorkbook.Path & "\Ongoing")
Else
Set wb = Workbooks("Ongoing")
Workbooks("Ongoing").Activate
End If


Thanks,

Albert.
 
J

Joel

try adding XLS. If a file has been saved you need the XLS.

If WorkbookIsOpen("Ongoing.xls") = False Then
Set wb = Workbooks.Open(ActiveWorkbook.Path & "\Ongoing.xls")
Else
Set wb = Workbooks("Ongoing.xls")
Workbooks("Ongoing.xls").Activate
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top