Results 1 to 6 of 6

Go to the filename specified in a cell

Threaded View

  1. #1
    Registered User
    Join Date
    10-23-2007
    Posts
    80

    Go to the filename specified in a cell

    Hello,

    I already have a macro that will open a file, the name of which is specified in cell A3 of my workbook (as it is subject to change). Now I just need my macro to activate the newly opened workbook at various points later on in the code. This is the code I have so far...

    Dim strFName As String
        
        strFName = ThisWorkbook.Worksheets("Upload Sheet").Range("B6").Value
        'this variable contains the workbook name and path
        If FileExists(strFName) Then
        'does it exist?
            If Not BookOpen(Dir(strFName)) Then Workbooks.Open Filename:=strFName
            'if its not already open, open it
        Else
            MsgBox "The file/location specified does not exist!"
        End If

    All I need now is to activate strFName basically, but I'm not sure of the code?

    Many thanks for your help!
    Last edited by lealea1982; 08-19-2013 at 12:05 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Find if filename exists and update variable within the filename structure
    By Lungfish in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 03-18-2013, 02:42 AM
  2. Replies: 0
    Last Post: 11-01-2012, 09:28 AM
  3. Code to create a custom .csv filename with version stamp in filename
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-10-2012, 04:07 AM
  4. Replies: 3
    Last Post: 07-09-2012, 03:09 PM
  5. filename cell updated with the filename inputed in the dialogue box
    By pba.mike in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-27-2007, 08:15 AM

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