Consulting

Results 1 to 10 of 10

Thread: using application.getopenfilename keeps opening new app

  1. #1
    VBAX Regular
    Joined
    Apr 2018
    Posts
    25
    Location

    using application.getopenfilename keeps opening new app

    Hi, I have a strange issue that happens only on my machine.
    Simply running the line with application.getopenfilename opens a new application (I mean new a p p l i c a t i o n/ excel process)
    The arguments/other factors do not matter, I get the same effect even if i run the line in the immediate window.

    Any idea?

  2. #2
    Moderator VBAX Guru Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    4,997
    Location
    Without seeing your code, we are simply guessing, however are you using this in the following format

    Filename = Application.GetopenFileName
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  3. #3
    VBAX Regular
    Joined
    Apr 2018
    Posts
    25
    Location
    Quote Originally Posted by Aussiebear View Post
    Without seeing your code, we are simply guessing, however are you using this in the following format


    [/CODE]
    What are you guessing bro?

    1. Put "application.GetOpenFilename" in immediate window
    2. Hit enter
    3. Select any file

    Bang! New application opens

  4. #4
    VBAX Regular
    Joined
    Apr 2018
    Posts
    25
    Location
    office reinstall didnt help

  5. #5
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,635
    Hi sis, why don't you use Excel ?

    Sub M_snb()
      With Application.FileDialog(3)
        If .Show Then Workbooks.Open .SelectedItems(1)
      End With
    End Sub

  6. #6
    Quote Originally Posted by snb View Post
    Hi sis, why don't you use Excel ?

    Sub M_snb()
      With Application.FileDialog(3)
        If .Show Then Workbooks.Open .SelectedItems(1)
      End With
    End Sub

  7. #7
    VBAX Regular
    Joined
    Apr 2018
    Posts
    25
    Location
    For some reason, application.filedialog has exactly the same effect - new excel process opens up

    (once again: it opens up when the dialog is used, even without workbooks.open )

  8. #8
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,158
    Location
    So if you run the below in a new excel file, does it open the file or return the name and location:
    Sub GetFileName()
        Dim Finfo As String
        Dim Title As String
        Dim FileName As Variant
        
        Finfo = "All Files (*.*),*.*"
        Title = "Select a File"
        
        FileName = Application.GetOpenFilename(Finfo, , Title)
        
        If FileName = False Then
          MsgBox "No file was selected."
        Else
          MsgBox "You selected " & FileName
        End If
    End Sub
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved

    Excel 365, Version 2401, Build 17231.20084

  9. #9
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,711
    Location
    Quote Originally Posted by mg25683 View Post
    What are you guessing bro?

    1. Put "application.GetOpenFilename" in immediate window
    2. Hit enter
    3. Select any file

    Bang! New application opens
    Then don't use the Immediate Window

    Use .GetOpenFilename in a macro
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  10. #10
    Does not happen for me. I suggest to do an on-line repair of your Office installation.
    Regards,

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •