Results 1 to 2 of 2

EXCEL VBA runtime error 1004 exiting function

Threaded View

  1. #1
    Registered User
    Join Date
    07-02-2014
    Location
    abilene, tx
    MS-Off Ver
    ms office 365
    Posts
    9

    EXCEL VBA runtime error 1004 exiting function

    i borrowed this code from someone on here. it works great, returns the correct result but when i exit the function i get a runtime 1004 error. i'm stumped. any help would be most appreciated!

     Private Function GetInfoFromClosedFile(ByVal wbPath As String, _
        wbName As String, wsName As String, cellRef As String) As Variant
        Dim arg As String
    
       GetInfoFromClosedFile = ""
        If Right(wbPath, 1) <> "" Then wbPath = wbPath & ""
        If Dir(wbPath & "" & wbName) = "" Then Exit Function
        arg = "'" & wbPath & "[" & wbName & "]" & _
            wsName & "'!" & Range(cellRef).Address(True, True, xlR1C1)
        On Error Resume Next
        GetInfoFromClosedFile = ExecuteExcel4Macro(arg)
        End Function
    Last edited by pandale; 02-25-2015 at 09:04 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Excel VBA Runtime error '1004' "If WorksheetFunction.Find" function
    By miguelitoven in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-11-2013, 04:34 PM
  2. Excel VBA Runtime 1004 Error
    By darian117 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-04-2012, 01:41 PM
  3. Using a macro to put a function in a certain cell (runtime error 1004)
    By Juhanen II in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-30-2007, 10:29 AM
  4. Runtime Error 1004 Excel 97
    By missfitz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-09-2006, 04:06 AM
  5. [SOLVED] Excel 2003 Macro Error - Runtime error 1004
    By Cow in forum Excel General
    Replies: 2
    Last Post: 06-07-2005, 09:05 AM

Tags for this Thread

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