+ Reply to Thread
Results 1 to 4 of 4

Workbooks.Open inside Function call

  1. #1
    Registered User
    Join Date
    07-25-2008
    Location
    Tucson, AZ
    Posts
    90

    Workbooks.Open inside Function call

    OK, try to follow my code modules here. I have a top-level Function-
    Please Login or Register  to view this content.
    inside this Function is a Sub

    Please Login or Register  to view this content.
    inside that Sub is a command to open an Excel workbook which is closed:

    Please Login or Register  to view this content.
    The problem is that the Workbooks.Open method does not work when I am using fit_surface_node as a Function. When I say I am using it as a Function, I mean that I have set the Boolean output_to_sheet as False, which skips any line of code which modifies any cell besides the one in which fit_surface_node resides.

    I know that a Function cannot modify other cells, but is it also prohibited from opening a workbook?

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,320

    Re: Workbooks.Open inside Function call

    Yes (thankfully)
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    07-25-2008
    Location
    Tucson, AZ
    Posts
    90

    Re: Workbooks.Open inside Function call

    so if I cannot open a workbook, can I copy data from a closed workbook to import into my VBA workspace?

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,320

    Re: Workbooks.Open inside Function call

    You can't copy as such but you can use ADO to extract tabular data from a closed workbook. You could also do this with native Excel functionality using the Get External Data functions.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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