Yahoo Answers is shutting down on 4 May 2021 (Eastern Time) and the Yahoo Answers website is now 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
    Favourite 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...

  • ?
    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 answers by asking now.