Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

excel macro command to allow user to select file to open?

How do you allow the user to run a macro but prompt the user to select the file to open? The macro would then continue running after the user has selected the appropriate file. I have the macro working but it requires the file name to always be the same. I would like to have the user be prompted to select the file to open.

3 Answers

Relevance
  • Randy
    Lv 4
    1 decade ago
    Favorite Answer

    Here is a little procedure that should get you started:

    Sub GetFileName()

      Dim strFileName As String

      strFileName = Application.GetOpenFilename

      If strFileName = "False" Then Exit Sub

      MsgBox strFileName

    End Sub

    Hope that helps...

  • pozzi
    Lv 4
    5 years ago

    Excel Macro Commands

  • Anonymous
    5 years ago

    nicely you the two could keep that workbook in Excel or interior the seen basic Editor window till now you close up it. it may be safer to keep it interior the seen basic Editor window. in case you close up that project without saving that report, the macro won't get saved.

Still have questions? Get your answers by asking now.