LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default sub vs. function bhavior regarding 'Workbooks' obj. functions

Hello guys,

This is my first post here and i really need help.

I'm writing a VBA function for excel that should parse its arguments
from one sheet based on tables on an entirly different Workbook file.

So, I wrote:
---------------------------
Public Function foo(...) as String
...
Workbooks.open Filename:= "path\filename.xls"
...
foo = result
End Function
---------------------------

But the thing isn't working, it doesn't open the file, though it
doesn't give any error messages. It just continue until it reach the
stage where it tries to read from the file and terminate.
This happens even when I manually open the file before hand!

The really ODD thing is that once I replace "Public Function/End
Function" with "Sub/End Sub" the file magically open!!!
So, what makes the difference?

PS: I really need it has a function.

PPS: I use Office 2000 on Win2000

regards,
Ali


---
Message posted from http://www.ExcelForum.com/

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Functions Available for all Workbooks Diego Miranda Excel Worksheet Functions 2 April 19th 10 10:11 PM
functions between workbooks. SteveDB1 Excel Worksheet Functions 2 October 16th 08 04:02 PM
Indirect and sumif functions with multiple workbooks acyakos Excel Discussion (Misc queries) 1 July 25th 08 01:37 AM
How do I make my functions public to all workbooks? DMB Excel Discussion (Misc queries) 3 February 16th 06 02:20 PM
Functions referencing unopened workbooks VB Newbie Excel Worksheet Functions 1 January 27th 05 01:11 AM


All times are GMT +1. The time now is 12:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"