Opening files from a form with a cmd btn

B

Brad

I have a command button that opens a pdf file when clicked, I have 2 questions
1. how do you force the file to be opened in a web browser (IE)?
2. can all the warning dialogs be suppressed

The code behind the button I am using is as follows

Application.FollowHyperlink Me.Text43
 
T

Tom van Stiphout

On Fri, 6 Mar 2009 05:33:01 -0800, Brad

You can't force that with FollowHyperlink. It will open the document
in the default viewer for that document type.
If you really need that, you'll have to look into using Automation
with IE.

-Tom.
Microsoft Access MVP
 
M

Mark Andrews

Aa a starting point try something like this:
Public Sub OpenWebPage(url As String)

Dim browser As Variant

Set browser = CreateObject("InternetExplorer.Application")
browser.Navigate (url)
browser.StatusBar = False
browser.Toolbar = False
browser.Visible = True
browser.Resizable = True
browser.AddressBar = False


End Sub
 
B

Brad

ok I can buy that, but when I click the cmd button it only brings adobe to
focus, It will not open the doc itself though, I have 7.0 std installed in
addition to 9.0 reader
 
M

Mark Andrews

You could put it anywhere. I have it in a regular module, then for example
on the click event of the button you would
have Call OpenWebPage(http://www.yahoo.com)

of course you would build the url you are passing the the function
appropriately for your needs.

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top