+ Reply to Thread
Results 1 to 12 of 12

open file in a folder

Hybrid View

  1. #1
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    open file in a folder

    Hi to all.
    This macro open a forder:
    Sub apriCartella1()
    
    On Error GoTo uscita
    
    ChDir "C:\Documenti\controllati\gr1"
    
    Application.Dialogs(xlDialogOpen).Show
    
    uscita:
    If Err.Number <> 0 Then
      ' MsgBox "la cartella non esiste o è stata spostata o cancellata", vbCritical, "ATTENZIONE!"
    MsgBox "la cartella non esiste o è stata spostata o cancellata", vbExclamation, "ATTENZIONE!"
    End If
    
    End Sub
    in this foder there is 3 type of file xls - xlsx - pdf
    if I click in the excel files they open normally
    if I click in a pdf it opens "text wizard" to view the pdf I have to right mouse> open.
    Because?

    I hope I have explained
    max

  2. #2
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: open file in a folder

    because, more than likely, you have to set your default programs to open any given file type in the windows CP.

  3. #3
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: open file in a folder

    Hi vba_php
    maybe I explained myself wrong.
    The pdf opens with its default program.
    What I wrote happens only inside the folder that I open with the macro

  4. #4
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: open file in a folder

    Quote Originally Posted by max_max View Post
    What I wrote happens only inside the folder that I open with the macro
    hmmmm....

    are you saying that you are clicking on the PDF when the dir opens after the dialog is called?

    on a side note, Italian looks very similar to Spanish! wow. Have you ever been to san giovanni rotonda?

  5. #5
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: open file in a folder

    I also know a very intelligent engineer who is in Italy. you probably don't know him though. a government man:

    https://www.access-programmers.co.uk...algent.138584/

  6. #6
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: open file in a folder

    Yes

    are you saying that you are clicking on the PDF when the dir opens after the dialog is called


    on a side note: never been to San Giovanni Rotondo
    https://it.wikipedia.org/wiki/San_Giovanni_Rotondo

  7. #7
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: open file in a folder

    well I don't think we're on the same page here, in terms of what we're talking about. when you CLICK TO OPEN a file of any kind in the windows explorer (the window you have opened with code), the code has absolutely nothing to do with it. once the window is opened, the windows OS is in control (as far as I know anyway). file extensions are associated with programs by default. this might be an issue with the KIND of code you are using. I've never used what you are using:
    Application.Dialogs(xlDialogOpen).Show
    I seriously doubt that's it. but, if it is, try this instead:
    Application.FileDialog (msoFileDialogFilePicker)
    it also could be an issue with your regional setting, but I do not know. I live in the USA, so that would be unknown to me. but I doubt that's the issue either.

  8. #8
    Registered User
    Join Date
    09-25-2020
    Location
    USA
    MS-Off Ver
    365
    Posts
    2

    Re: open file in a folder

    Quote Originally Posted by max_max View Post
    Hi to all.
    This macro open a forder:
    Sub apriCartella1()
    
    On Error GoTo uscita
    
    ChDir "C:\Documenti\controllati\gr1"
    
    Application.Dialogs(xlDialogOpen).Show
    
    uscita:
    If Err.Number <> 0 Then
      ' MsgBox "la cartella non esiste o è stata spostata o cancellata", vbCritical, "ATTENZIONE!"
    MsgBox "la cartella non esiste o è stata spostata o cancellata", vbExclamation, "ATTENZIONE!"
    End If
    
    End Sub
    in this foder there is 3 type of file xls - xlsx - pdf
    if I click in the excel files they open normally
    if I click in a pdf it opens "text wizard" to view the pdf I have to right mouse> open.
    Because?

    I hope I have explained
    max
    You might use the method Adam suggested, and then, once Application.FileDialog (msoFileDialogFilePicker) has returned a file name, use ThisWorkbook.FollowHyperlink

  9. #9
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: open file in a folder

    Hi,
    maybe what I ask is not possible?

  10. #10
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: open file in a folder

    Quote Originally Posted by max_max View Post
    Hi,
    maybe what I ask is not possible?
    it's has nothing to do with that, Max. it has to do with the fact that no one who responded to you understands what is going on, on your end. that's why. did you try what I said? use the alternative method to open the picker?

  11. #11
    Registered User
    Join Date
    09-25-2020
    Location
    USA
    MS-Off Ver
    365
    Posts
    2
    Quote Originally Posted by max_max View Post
    Hi,
    maybe what I ask is not possible?
    Why would you say that? if you combine what Adam said and what I said you have a solution.
    Me no understand you!

  12. #12
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: open file in a folder

    Quote Originally Posted by isaac123 View Post
    Why would you say that? if you combine what Adam said and what I said you have a solution.
    well let us not be mean, shall we? but hey, good point!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 8
    Last Post: 12-02-2019, 03:42 PM
  2. [SOLVED] Open newest folder and specific file in the folder
    By timtim91 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-09-2017, 11:55 AM
  3. [SOLVED] Open specific folder, select file to open and copy then paste
    By Kranky in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-22-2012, 12:14 AM
  4. How to get the open file dialog to open to a certain folder
    By tenk283 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-01-2010, 11:54 PM
  5. File Open Dialog Box Open at Set Folder
    By Soltisolti in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-10-2007, 10:05 PM
  6. open file from folder save in new folder
    By tim64 in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 06-17-2005, 03:19 PM

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