Results 1 to 7 of 7

Thread: Open file

  1. #1
    Join Date
    Nov 2002
    Location
    Sweden
    Posts
    14

    Unanswered: Open file

    How may I, by clicking a cmdbutton, open a pdf-file without knowing the correct name and path of the acrobat-exe and without getting any message pop-ups?

    Thanks
    Sebastian

  2. #2
    Join Date
    Jul 2002
    Location
    Australia
    Posts
    147
    If the user's machine had PDF Reader installed then it will associate the file with the extension and open automatically I think you can use the Shell() command to do this.

    What types of pop-ups are you talking about?

    Cheers,
    Andrew
    There have been many posts made throughout the world.
    This was one of them.

  3. #3
    Join Date
    Nov 2002
    Location
    Sweden
    Posts
    14
    Well, i just can´t figure out how to open a file using Shell() without knowing the app-path. Any ideas?
    Sebastian

  4. #4
    Join Date
    Jul 2002
    Location
    Australia
    Posts
    147
    Musn't be Shell() then. I'm pretty sure there's another function you can use. I'll have a squiz at work tomorrow.

    In the meantime, search google and you'll find some answers easily.

    Edit: I was close, it was ShellExecute:
    http://www.mvps.org/access/api/api0018.htm

    Cheers,
    Andrew
    Last edited by Bunce; 02-26-03 at 08:33.
    There have been many posts made throughout the world.
    This was one of them.

  5. #5
    Join Date
    Jul 2002
    Location
    Australia
    Posts
    147
    Bumb.

    See above.
    There have been many posts made throughout the world.
    This was one of them.

  6. #6
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    Originally posted by Bunce
    Bumb.

    See above.
    try
    Call Shell("C:\open.bat", vbHide)

    where the batch file contains the file name of the pdf file

    if you want to get fancy you can have vb right the batch file and delete it once it's finished with it
    Open "c:\Temp.bat" For Append As #1
    Print 1, "c:\somefile.txt" & vbCrLf & "del c:\temp.bat"
    Close #1
    Shell "c:\temp.bat", vbHide
    Last edited by m.timoney; 02-26-03 at 09:46.
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  7. #7
    Join Date
    Nov 2002
    Location
    Sweden
    Posts
    14
    Thank you very much, its working now...=)
    Sebastian

Posting Permissions

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