+ Reply to Thread
Results 1 to 3 of 3

Want to Get Rid of File Name Used in Coding

  1. #1
    Registered User
    Join Date
    01-14-2014
    Location
    Ahmedabad
    MS-Off Ver
    Excel 2007
    Posts
    15

    Want to Get Rid of File Name Used in Coding

    Hi,

    I am using the below code to copy data from one file and paste it to another file. Before the below code runs it opens a file from a specific path in the shared drive and then starts pasting the data which i have in my currently opened file.

    Please Login or Register  to view this content.
    As you guys can see i have used the file name in coding, whenever someone changes the file name the code throws. "Subscript out of range" error. I am a very new programmer, i would like to know how can i assign the name dynamically in my coding so that the change of name of the file doesnt impact the functionality of the code.

    Thanks in advance
    Last edited by Fotis1991; 01-31-2014 at 04:18 AM. Reason: Pls use code tags around your codes.

  2. #2
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: Want to Get Rid of File Name Used in Coding

    Instead of specifying by name you can use :-
    > ThisWorkbook to refer to the workbook where the code is
    > ActiveWorkbook to refer to the workbook in use
    Elegant Simplicity............. Not Always

  3. #3
    Registered User
    Join Date
    01-14-2014
    Location
    Ahmedabad
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Want to Get Rid of File Name Used in Coding

    Thanks Andy. It worked

+ 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. Coding a MACRO to list document name and file path
    By Vokey9 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-29-2013, 03:16 PM
  2. how to import las file through vba coding
    By srinivasgeo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-04-2013, 03:07 AM
  3. PDF File Convert in Excel by the VBA coding
    By vansh in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-18-2013, 01:42 PM
  4. Urgent help for writing text file to excel using macro coding
    By praveenvinay in forum Excel General
    Replies: 0
    Last Post: 06-26-2012, 09:02 AM
  5. [SOLVED] VBE file open coding
    By Bill in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-28-2005, 05:06 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