+ Reply to Thread
Results 1 to 4 of 4

Open file via VBA and paste filename in original file

  1. #1
    Registered User
    Join Date
    01-29-2013
    Location
    The Netherlands
    MS-Off Ver
    2016 x64
    Posts
    48

    Post Open file via VBA and paste filename in original file

    Hi there,

    I want to copy/paste the file name of the file that I opened with VBA into the original file.

    So, I have a "master file" (that contains all macros) and I have a "source file". The source file is opened via vba from the master file.

    What I want to achieve is that the file name (and FullName) from that source file is transferred to a cell in the master file.

    Now I am struggling to get the filename in a variable. Keep getting errors when selecting the first button in the menu form, and I do not understand how to fix that.


    Attached: the Master File and the Source File.
    Attached Files Attached Files

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Open file via VBA and paste filename in original file

    Hi kammend

    Replace your Workbook.Open Code with this
    Please Login or Register  to view this content.
    Replace your Module 1 Code with this
    Please Login or Register  to view this content.
    Attached Files Attached Files
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    01-29-2013
    Location
    The Netherlands
    MS-Off Ver
    2016 x64
    Posts
    48

    Re: Open file via VBA and paste filename in original file

    Thanks John! That solved my problem :-)

    Daniel

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Open file via VBA and paste filename in original file

    You're welcome...glad I could help.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Delete a file that has just been saved and open original file or vice versa.
    By SHB19 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-17-2015, 07:48 AM
  2. Replies: 4
    Last Post: 10-23-2013, 12:54 AM
  3. Replies: 3
    Last Post: 05-21-2013, 08:22 AM
  4. [SOLVED] open variably named file, copy/paste data into consolidation file, open next file in list
    By sllawrence1968 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-29-2012, 09:49 PM
  5. Macro to keep original file open, not 'save as' file
    By LonestarGuy in forum Excel General
    Replies: 4
    Last Post: 06-09-2010, 03:53 PM
  6. Macro won't open original file?
    By Rick_Stanich in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-14-2006, 06:31 PM

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