Function VS. Sub

Joined
May 22, 2006
Messages
1
Reaction score
0
I have written a sub in VBA that opens a workbook and returns a certain value from there then closes the workbook. I have tested the Sub and it works perfectly well. The code used in the Sub is not working in a UDF, the problem relies in the Workbook.Open function, for some reason, the UDF is not opening that workbook. I am getting the following msg: "VBAProject..(function name)-> 91: Object variable or with block variable not set"

I would like to obtain some help whether Workbook.Open function is not supported inside a Function. I would write the Sub code if necessary.

I would be grateful for any help.
 

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