Results 1 to 12 of 12

Thread: Automatically select specific file from dialog Box

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2017
    Posts
    108

    Lightbulb Automatically select specific file from dialog Box

    Hi
    I'm trying to open one of the tool of 3rd party application through VBA.
    When i trying open a dialog box is appeared to select that tool.
    Name:  Untitleds.jpg
Views: 373
Size:  43.1 KB
    but I don't want to open this dialog box.
    Any one know how to select the tool directly (without opening dialog box)

    is that possible to do this?


    Thanks in Advance

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Automatically select specific file from dialog Box

    is that possible to do this?
    it depends what you want to do with the selected file

    what code do you have that opens the dialog and after close?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2017
    Posts
    108

    Re: Automatically select specific file from dialog Box

    Just i have a command button and assign a hyperlink for that file, but when i click the command button it is appeared a dialog box only.
    again i need to select the file in that dialog box as manually then only it will open.

    what i need , when i click the command button the application should be open automatically(dialog box should not be appeared)

    Thanks

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Automatically select specific file from dialog Box

    what is the href for the hyperlink?

    what is the name of the file you need to select?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Sep 2017
    Posts
    108

    Re: Automatically select specific file from dialog Box

    i'm not using vba, just i have create a Shape and assign Hyperlink for that file.
    The name of the file is CRIS_AB.zmd, its one of the application tool.

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Automatically select specific file from dialog Box

    as i do not have enough information, the only thing i can suggest is to use the shellexecute API, with the OPEN parameter, assuming that the .zmd files are associated to some application

    search in this forum (or vb6 forum) for shellexcute, for declaration and usage
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Sep 2017
    Posts
    108

    Re: Automatically select specific file from dialog Box

    Hi westconn
    Thanks for your suggetion. But i don't have any idea about shellexcute.
    I want to open that application through Excel only.
    shellexcute is Vba or what?

  8. #8
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Automatically select specific file from dialog Box

    shellexcute is Vba or what?
    a windows API that can be called from VBA
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Sep 2017
    Posts
    108

    Re: Automatically select specific file from dialog Box

    Thank you so much for your info..

  10. #10
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Automatically select specific file from dialog Box

    a quick search brought me to http://www.vbforums.com/showthread.p...ecute-in-Excel and thousands of other



    declaration
    Code:
    Private Const SW_SHOWNORMAL = 1
    
    Private Declare Function ShellExecute Lib "shell32.dll" Alias _
      "ShellExecuteA" (ByVal Hwnd As Long, ByVal lpOperation As String, _
      ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As _
      String, ByVal nShowCmd As Long) As Long
    call like
    Code:
    vRetVal = ShellExecute(0, "Open", "fullpath\CRIS_AB.zmd", vbNullString, vbNullString, SW_SHOWNORMAL)
    i can not in anyway say this will actually do what you want, but without a lot more information, it is probably your only option

    you can look in windows to see if zmd files are associated with any application
    if you can double click a .zmd file in windows explorer to open it, shellexecute should work
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Sep 2017
    Posts
    108

    Re: Automatically select specific file from dialog Box

    Thanks Westconn
    I have tried the code which is getting from the link you given... it was working but again it's showing the dialog box only. again i need to select the file manually.

    Thanks

  12. #12
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Automatically select specific file from dialog Box

    here is another you can try, i have no real idea if it might work
    for more information see https://www3.rocketsoftware.com/blue...ne_Support.htm

    Code:
    shell BZMD.EXE /FCRIS_AB.ZMD
    you may need to supply full path to both the exe and the config file, if the path to either may contain spaces, it will have to be enclose in quotes AND the quotes will have to be escaped
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

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



Click Here to Expand Forum to Full Width