Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9009361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:10:18+00:00 2026-06-16T02:10:18+00:00

I am newbie in Excel. I need to something like below. When user click

  • 0

I am newbie in Excel. I need to something like below.

When user click on a cell or enter to cell:

  1. It should automatically open/close file window.

  2. When user select a file, it should pick up path/filename and put into the cell, like c:\folder1\file1.ext

  3. If user select more than one file, it should pick up all path/filenames into cell,with | as delimiter. like c:\folder1\file1.ext|d:\folder2\file2.ext

  4. If user click on a cell or enter to cell for a second time, it should keeps existing path/filenames and let to add other path/filnames to them like in number 3

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T02:10:19+00:00Added an answer on June 16, 2026 at 2:10 am

    This is similar to Sid’s, just lets you double click any single cell to open the file dialog.

    In a Module

    image showing where to paste the getList code

    Public Function getList(Optional ByVal Target As Range = Nothing) As String
    Dim Dialog As FileDialog
    Dim File As Integer
    Dim Index As Integer
    
    Dim List() As String
    Dim Item As Integer
    Dim Skip As Boolean
    
    Set Dialog = Application.FileDialog(msoFileDialogFilePicker)
    
    File = Dialog.Show
    
    If File = -1 Then
        ' Get a list of any pre-existing files and clear the cell
        If Not Target Is Nothing Then
            List = Split(Target.Value, "|")
            Target.Value = ""
        End If
        ' Loop through all selected files, checking them against any pre-existing ones to prevent duplicates
        For Index = 1 To Dialog.SelectedItems.Count
            Skip = False
            For Item = LBound(List) To UBound(List)
                If List(Item) = Dialog.SelectedItems(Index) Then
                    Skip = True
                    Exit For
                End If
            Next Item
            If Skip = False Then
                If Result = "" Then
                    Result = Dialog.SelectedItems(Index)
                Else
                    Result = Result & "|" & Dialog.SelectedItems(Index)
                End If
            End If
        Next Index
        ' Loop through the pre-existing files and add them to the result
        For Item = UBound(List) To LBound(List) Step -1
            If Not List(Item) = "" Then
                If Result = "" Then
                    Result = List(Item)
                Else
                    Result = List(Item) & "|" & Result
                End If
            End If
        Next Item
        Set Dialog = Nothing
        ' Set the target output if specified
        If Not Target Is Nothing Then
            Target.Value = Result
        End If
        ' Return the string result
        getList = Result
    
    End If
    End Function
    

    In Your Worksheet’s Code

    image showing where to paste the sheet code

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
        If Target.Rows.Count = 1 And Target.Columns.Count = 1 Then getList Target
    End Sub
    

    Update
    I’ve changed the getList function (it wasn’t broken, just made it do more)

    • It will allow you to double click any cell, which will open a file dialog.
    • You can select 1 (or more) files
    • The file names will be joined with the “|” character and put in the target cell
    • If any pre-existing files are in the cell, the new ones will be appended to them
    • It does not however support pressing enter to open the file dialog, you must double-click the cell.

      Update
      To help VMO (commenter)

      The code in the worksheet module:

      Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
          If Target.Rows.Count = 1 And Target.Columns.Count = 1 Then
              If Target.Address = "$A$1" Then ' See Notes Below
                  Target.Value = getList(Target)
              End If
          End If
      End Sub
      

      To restrict what cell(s) are double-click’able you will need to use something like that. You can change $A$1 to whatever you want or find a way to determine the target range’s name (not too difficult)

      If your worksheet is not locked the cell that is clicked will keep focus, and be in edit-mode which is a little annoying. Locking the cell, in previous versions of excel fixed this (i think it doesn’t work in v.2010+ though)

      The code in the module (getList) can remain almost exactly the same (although you might want to remove all the code that deals with multiple files, not required though). All you need to do is add one line of code.

      .......
      Dim Skip As Boolean
      
      Set Dialog = Application.FileDialog(msoFileDialogFilePicker)
      
      Dialog.AllowMultiSelect = False ' This will restrict the dialogue to a single result
      
      File = Dialog.Show
      
      If File = -1 Then
      ......
      

      Hope this helps and I’ve understood what you were asking!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

    Sidebar

    Related Questions

    I'm an Excel VBA newbie. How to change the value of the specified cell
    Newbie to windows scripting. I need help running the .bat file on the command
    Newbie question: some vendors propose solution like generating dynamic certificates to allow user who
    Newbie question. I want to do something like: SELECT c1,c2,c3 FROM TABLE t1 UNION
    Newbie question. I have Django models that look like this: class Video(models.Model): uploaded_by =
    VBA newbie over here. I'm trying to use an array formula through excel vba
    I have data in data table like below. I am trying to make graph
    newbie here .. wondering why in the table i get something called '[object node]'
    I am a newbie with add-in programming and need help with the following scenario:
    Am a newbie to WCF.I have a scenario where i need to create a

    Explore

    • Home
    • Add group
    • Groups page
    • Communities
    • Questions
      • New Questions
      • Trending Questions
      • Must read Questions
      • Hot Questions
    • Polls
    • Tags
    • Badges
    • Users
    • Help
    • SEARCH

    Footer

    © 2021 The Archive Base. All Rights Reserved
    With Love by The Archive Base

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.