Closed Thread
Results 1 to 3 of 3

Custom VBA function doesn't work

  1. #1
    Forum Contributor
    Join Date
    09-28-2007
    Location
    New York, NY
    MS-Off Ver
    2007
    Posts
    120

    Custom VBA function doesn't work

    I wrote a function in VBA called OpenSPDFiles:

    Please Login or Register  to view this content.
    i pass it those parameters and it opens the file(s) specified by the parameters. in the end OpenSPDFiles equals a string that is just the concatenated filenames of the files it opened. if i dont pass an argument, a userform opens up and asks for the data.

    when I call it from another VBA code, it works fine - the files open. but if i go into an excel cell and type =OpenSPDFiles(... the files dont open. but the cell value DOES show the file names of what was supposed to open. AND, if i dont supply one of the params, the userform DOES show. why doesnt the function open the files? I use Workbooks.Open (sPath & sFile) to open. when i step through the code called from the excel cell, i see it highlight the Workbooks.Open but it just doesnt execute. any ideas?


    thanks,
    Joe
    Last edited by MCCCLXXXV; 09-26-2008 at 04:51 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Please read the Forum Rules about thread titles, and then start a new thread with an appropriate title.

    You might also post the rest of the code.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello MCCCLXXXV,

    This site explains very well what User Defined Functions can and can't do and why.

    Excel User Defined Functions

    Sincerely,
    Leith Ross

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Unable to get Array Formula Using Sum Function to work
    By kingjams in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-22-2007, 07:19 AM
  2. Problem getting a function to work
    By chance in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-11-2007, 01:56 PM
  3. Calling function from worksheet with nonconcurrent range
    By jrodgold in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-27-2007, 05:17 PM
  4. Analysis Toolpak Function XIRR and VBA - XL 2007
    By rvExcelNewTip in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-02-2007, 04:35 AM
  5. Pulling a worksheet name from cell value (custom function needing help)
    By Kurisu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-21-2006, 09:09 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1