Question

Open MS Word Application inside an IE frame

Asked by: okeanos1012

Hello, is there a way to open a Word application inside of a frame?  I need to be able to at the very least display the Standard and Formatting toolbars.

I'm trying to create a web page that has a side menu listing documents in a Case.
When the users select the document, I would like to be able to open up the Word application and load the selected document inside the adjacent frame.

I have been able to open Word documents from the web, but have ran into the following problems:
1)In one environment, when I place the path to the Word document inside an anchor tag, the Word document opens inside the IE browser, but the toolbars do not display. However, I am able to access its menu bar and then display the toolbars.  I need to be able to do this programatically.  I've tried to place the following function inside the document macro but it did not work.

Sub AutoExec()
      ActiveDocument.CommandBars("Standard").Visible = True
End Sub

2)In another environment (also IE), when you click on the link, it downloads the document, and then opens the entire Word application, but not inside of the IE window.  I don't know what setting in IE causes this behavior.  Is there a way for me to program IE to ensure that it behaves like it did in the other environment?

3)I've tried to create an ActiveX control using VB 6 and embed the object inside a frame.  I am able to activate the Word application and load the document, but again, I don't know how to direct the Word application to open inside of the IE container.

Please help.

Thanks!

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2003-10-24 at 14:52:12ID20777519
Tags

word

,

open

,

document

Topic

Web Development Software

Participating Experts
1
Points
200
Comments
15

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. AutoExec
    How to bypass AutoExec for any DB opened from VBA: Dim AC As Access.Application Set AC = CreateObject("Access.Application") AC.OpenCurrentDatabase DBfileName 'AutoExec executed, ' but I need to have it disabled.
  2. Word2000 Clipboard Toolbar AutoExec
    I want the Clipboard Toolbar to dock at on the righthand side of the 2nd row. How can I accomplish this? The code below is what is offered from M$'s KB. Is there some way to modify this code to dock it to the righthand side of row 2? Sub AutoExec() Dim cbClip As Command...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: JNSTAUBPosted on 2003-10-27 at 02:41:53ID: 9626004

from msdn:
The following two basic approaches to controlling the behavior will be discussed:
As a user, you can set client options through Windows Explorer. The advantage of this approach is that the user retains control of the browser's behavior.
As a Web author, you can write client-side script. The advantage of this approach is that you can customize the client behavior from a central location. However, there is a caveat: implementing this method requires a client-based installation of Office 97 and is inherently slow.
Use the following steps for the first approach--setting client options through Windows Explorer:
Launch Windows Explorer.
From the View menu, select Options("Folder Options" if Internet Explorer 4.0 is installed).
From the Options dialog box, click the File Types tab.
From the listing of "Registered File Types," select "Microsoft Word Document," and click Edit.
From the Edit File Type screen, clear the "Browse in same window" check box, which toggles whether a Word document is launched outside of Internet Explorer.
Click OK to close the dialog boxes.
Note that behind the scenes, simple Registry flags are being set, which means that someone with experience in creating .Reg files can automate this change.

For the second approach, as a Web author you can control the behavior of a Word document through OLE Automation, provided the client is running Microsoft Word. Here are the basic steps:
Create a client-side function that instantiates Microsoft Word, and accepts the URL of the document as its argument.
Create a button to call the function, passing the URL of the Word document.

Here's a sample client-side script using automation with Word 97 installed on the client computer:   <HTML>
   <HEAD>
   <SCRIPT LANGUAGE=VBScript>
   Dim objWord
   Sub Btn1_onclick()
   call OpenDoc("http://MyServer/MyTest.doc")
   End Sub

   Sub OpenDoc(strLocation)

   Set objWord = CreateObject("Word.Application")
   objWord.Visible = true
   objWord.Documents.Open strLocation
   End Sub

   </SCRIPT>
   <TITLE>Launch Word</Title>
   </HEAD>
   <BODY>
   <INPUT TYPE=BUTTON NAME=Btn1 VALUE="Open Word Doc">
   </BODY>
   </HTML>

 

by: okeanos1012Posted on 2003-10-27 at 07:51:07ID: 9627625

Hey, thanks for the response!  You have answered my question on how to open the Word document inside the browser insteading of having it be downloaded.  But the bigger question is how do I get the Word application to open inside of a frame, with the menu and toolbars displaying.  One major thing that I had left out is that the Word documents may be stored inside of an Oracle database as a BLOB.   I don't believe that I can retrieve it using VBScript, which is why I  implemented ActiveX control. (Although I could retrieve the BLOB into a file using plsql, it is the path w/the most resistence right now.  Politics, don't ask.)   I have an ActiveX control embedded in one frame.  When I activate it, I hope to be able to download the blob into a file in the client's local directory (I've got this down)and then open it up inside of a frame, with the menu bar and toolbars available.

 

by: JNSTAUBPosted on 2003-10-27 at 08:26:34ID: 9627894

the example works perfectly even if t's a frame, if you are able to download the blod into a file, simply rename the file with doc extension:
call opendoc("c://tempdownload/mydoc.doc")

for my point of view i answered to your question. now download difficulty and blod conversion is an other question.

 

by: JNSTAUBPosted on 2003-10-27 at 08:50:00ID: 9627999

 

by: okeanos1012Posted on 2003-10-27 at 11:44:44ID: 9629239

Hello again.  The article that you've refered me to is pretty good but I'm already able to download and upload my Word document from/to the database using ActiveX.  I am also able to open up the Word document inside a frame.  The problem is opening the Word document and application in its entirety, menus and toolbars and all, inside of a frame.  

When I use your code, the document opened a Word application in a separate window as well.  Is there a way to instantiate the Word object and set its parent container?  Have you tested the code that you wrote out?  If the same code behaves differently in your environment then maybe it's my browser setting.  Also, when I open a Word doc inside of a frame, I get the Word document, but just that and the ruler.  Somehow the menu bar and the toolbars are hidden.

 

by: JNSTAUBPosted on 2003-10-28 at 00:34:58ID: 9632220

 

by: okeanos1012Posted on 2003-10-28 at 11:52:36ID: 9636376

Hey JNSTAUB, guess what I just discovered?  So instead of using the AutoExec() macro inside of a Word document, I used AutoOpen() instead to set the standard and formatting menu to be a floating menu.  I was hoping that if they were floated on top they would be visible.  When I opened up the document in a frame I can see a shadow of the menu, it seems to be hidden behind the web page, behind the frames of the page.  I'm still not sure what to do about it, but atleast I now know that the Word app.  menu is actually there, but it's just hidden.

 

by: okeanos1012Posted on 2003-10-30 at 08:00:22ID: 9651012

I have found a way to access the IE window that my ActiveX control is embedded in.  In my VB code, I can make the following reference:

   UserControl.Parent.script.document.location = "H:\test\sample.doc"

 Hopefully, by traversing the IE DOM, I can control the Word application as well.
The following article seems promising:

Accessing the Internet Explorer Document Object Model from
Visual Basic 5.0
http://www.microsoft.com/mind/0898/dom.asp

 

by: okeanos1012Posted on 2003-10-31 at 06:21:41ID: 9657672

According to the article on the IE browser architecture:

http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/overview/overview.asp

Iexplore.exe is at the top level
           /
Shdocvw.dll (Webbrowser control)
         /
mshtml.dll  (MSHTML)
        /
html (and embedded components such as ActiveX, Java Applets, etc)

Using "UserControl.Parent.parentWindow" I could access the MSHTML level, but I can't seem to go beyond that.  I've tried referencing
    UserControl.Parent.parentWindow.Parent
    UserControl.Parent.parentWindow.navigotor

 

by: okeanos1012Posted on 2003-10-31 at 06:25:38ID: 9657700

Opps, hit the Submit button prematurely.  I've also tried to get to the Webbrowser level using:
   UserControl.Parent.parentWindow.eternal
   UserControl.Parent.parentWindow.window

The reason why I'm trying to access the Webbrowser level is that the article mentioned above states:
"Shdocvw.dll in turn hosts the Mshtml.dll component, as well as any other Active Document component (such as a Microsoft Office application) that can be loaded in place in the browser when the user navigates to a specific document type. Shdocvw.dll supplies the functionality associated with navigation, in-place linking, favorites and history management, and PICS support."

 

by: okeanos1012Posted on 2003-10-31 at 12:17:16ID: 9660214

Got it! ..almost

1)Add Microsoft Internet Controls to your project's components
2) The following will provide you with the current shellwindows collection, which is all the open windows.

Dim objShell As ShDocVwCtl.ShellWindows
Set objShell = New ShDocVwCtl.ShellWindows

3)
Dim objIE As WebBrowser

For Each objWin IN objShell

   'Find the existing IE browser window that host my web page
   If UCase(objWin.FullName) = UCase("C:\Program Files\Internet    Explorer\iexplore.exe") _
  & UCase(objWin.LocationName) = UCase("test_actx.htm") Then

      Set objIE = objWin                  

   End If      

Next objWin
      
'Now you can modify the existing browser
objIE.AddressBar = False
      
I still need to find the Word toolbar and bring it to the front.  Any ideas?      

 

by: okeanos1012Posted on 2003-11-03 at 07:43:16ID: 9671632

Final resolution!

From my ActiveX control, I download the Word document, which is stored as a BLOB inside an Oracle table, using ADODB.Stream.  Once the document is downloaded, I issue the following statements to redirect the frame to the Word document:
     Dim objCurrBrowser As HTMLWindow2  'Microsoft HTML Object Library
     Set objCurrBrowser = UserControl.Parent.Script.Document.parentWindow
     objCurrBrowser.Frames(1).Location = "H:\My Documents\sample.doc"

Inside of the sample.doc file, I created the following auto macro:
    Sub AutoOpen()
       ActiveDocument.CommandBars("Standard").Visible = True
       ActiveDocument.CommandBars("Formatting").Visible = True
   End Sub

Yep, it's as simple as that!  It's not a perfect solution, but for now, it's good enough for me.

 

by: okeanos1012Posted on 2003-11-04 at 13:29:55ID: 9682256

Actually, instead of adding the AutoOpen() macro to your document, you may specify the following from the activeX control code after you have redirected  your frame to your Word document location:

Dim objCurrDoc As Word.Document
Set objCurrDoc As Word.ActiveDocument

objCurrDoc.CommandBars("Standard").Visible = True
objCurrDoc.CommandBars("Formatting").Visibile = True

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...