Results 1 to 6 of 6

Open file from location using VBA code - file name changes everytime.

Threaded View

  1. #1
    Registered User
    Join Date
    06-20-2013
    Location
    India, Pune
    MS-Off Ver
    Excel 2003
    Posts
    6

    Open file from location using VBA code - file name changes everytime.

    Hi,
    I need help to write a code to open a User name workbook from a location. This code should be in master file (Update_Report.xls) user will enter data in master file & press button to perform below actions.
    Open perticular User name (Cell value B4 in Update_Report) excel workbook from location.
    Copy data from master file.
    Paste data in user file.
    Save & close user file.

    Code is as below. Code is not able to locate user file.

    Sub Button8_Click()
    
      'Open user file & copy data
    
      FName = Range("B4")
      
      ChDir "C:\TEST\User Report"
        Workbooks.Open Filename:= _
            "C:\TEST\User Report\FName"
          Workbooks("Update_Report.xls").Activate
        Range("A1:B7").Copy
        Workbooks("FName").Activate
        Range("B5").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Application.CutCopyMode = False
    
    End Sub
    I am not able to upload master file due to some error. After I press button "Manage Attachments" nothing happens.

    Please help me with this.
    Thanks in advance.

    SWapnil
    Last edited by Leith Ross; 07-27-2013 at 02:29 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] [Help]macro to open file browser, to select a location, and save the location to a cell
    By zhuleijia in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-06-2013, 09:56 AM
  2. Replies: 5
    Last Post: 09-29-2012, 12:40 PM
  3. VBA for excel 2003. Open file dialog box, open 2007 file xlsx, continue with code
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-25-2011, 12:12 AM
  4. Replies: 0
    Last Post: 08-11-2006, 11:15 AM
  5. [SOLVED] code to check file size everytime an Excel file is opened
    By Kaiser in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-30-2006, 12:50 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