Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft's Web Browser Control

Status
Not open for further replies.

LadyDev

Programmer
Jan 29, 2003
86
US
I have an Access2000 database. I have embedded a browser in a form using the Web Browser control. It is all working okay - it displays the document. How can I add additional functionality to the form, i.e., save, print, etc.
 

Private Sub WebPrint_Click()
'Print the current page
On Error Resume Next
WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_PROMPTUSER
End Sub

Private Sub WebSave_Click()
'Save the page
On Error Resume Next
WebBrowser1.ExecWB OLECMDID_SAVEAS, OLECMDEXECOPT_PROMPTUSER
End Sub

Anthony J. DeSalvo
President - ScottTech Software
"Integrating Technology with Business"
 
Thanls for your response. Okay, I may have confused the issue. What I have is documents with varying extensions (.xls, .txt, .rst, .ppt, .doc, etc). Althought the web browser opens the documents (well at least the .doc), it doesn't have any other functionality. What I would like to have happened is allow the document open with its' respective software. That is, if the .xls document is selected have that open with Excel, if a .txt document is selected have it open notepad, and so on.
 
Forgot to mention you may also need something like this in a module:

Code:
Public Type SHELLEXECUTEINFO
    cbSize As Long
    fMask As Long
    hWnd As Long
    lpVerb As String
    lpFile As String
    lpParameters As String
    lpDirectory As String
    nShow As Long
    hInstApp As Long
    lpIDList As Long 'Optional parameter
    lpClass As String 'Optional parameter
    hkeyClass As Long 'Optional parameter
    dwHotKey As Long 'Optional parameter
    hIcon As Long 'Optional parameter
    hProcess As Long 'Optional parameter
End Type

Declare Function ShellExecuteEX Lib "shell32.dll" Alias "ShellExecuteEx" (SEI As SHELLEXECUTEINFO) As Long
[pc2]
 
If you have a Text Control on your form, you could place the following code on the Double-Click event:

Application.FollowHyperlink Me!DocumentName

So, if Me!DocumentName = "C:\My Documents\MyWord.doc", and it is a Word document, MS Word will fire up and you will have your doc at your ready!

Anthony J. DeSalvo
President - ScottTech Software
"Integrating Technology with Business"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top