I've a VB Problem here.....there are 2 frames in a single form. the first frame contains few command buttons. if I click on the one of the command buttons, it should open a word application within the second frame. a frame can contain controls, can it contain a window within itself. the problem is that I'm able to open the word application as a seperate window not within frame 2. Please help me with this.

Who is Participating?
bobbit31Connect With a Mentor Commented:
you can use the ole container control.

put an ole container on the form and select microsoft word document for the class.  you can either set the sourcedoc property at run-time or design-time.  set the ole1.action property to 7 to activate the document (word menus will appear so you can edit)

one problem you might run into is that you have to implement your own scrollbars... This might help you on your way to doing that:

1. Start Visual Basic; Form1 is created by default.

2. Add an OLE container control to Form1 (Ole1 is the default name for the control).

3. The insert object dialog box should appear after you draw the OLE container control on the form. Choose Create from the File option, and choose an existing Word .DOC file that is more than a page in length. The "Link" and "Display As Icon" check boxes should not be selected. Choose the OK button when you are done; the document should now be embedded in the OLE container control.

4. Add a VScrollBar button to Form1 (SpinButton1 is the default name of the control).

5. Place the following code in the UpDown1_DownClick event:

Private Sub UpDown1_DownClick()
If OLE1.AppIsRunning Then
OLE1.Object.Application.WordBasic.VLine -1
         OLE1.Action = 7        'Activate
End If
End Sub

6. Place the following code in the UpDown1_UpClick event.

Private Sub UpDown1_UpClick()
If OLE1.AppIsRunning Then
OLE1.Object.Application.WordBasic.VLine 1
         OLE1.Action = 7           'Activate
End If
End Sub

7. Save the project.

8. Run the application.

9. Double-click the OLE control to activate the Word .DOC object for visual editing.

10.Press the VScrollBar button to scroll up and down the document.

good luck!

Richie_SimonettiIT OperationsCommented:
Interesting... i have some on that matter.
Valliappan ANSenior Tech ConsultantCommented:
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.


Here's another alternative:

Description: Start a program inside another (3K)

Just change the picture control to that of a frame control and see how it works : )  It's fun : ) The program would be 'trapped' in the control.

Remember also that you'll need to have the path of Microsoft Word.

That's it!

glass cookie : )
Richie_SimonettiIT OperationsCommented:
My code is the same as glass cookie posted, sorry.
But vb-helper is down.
If you change the second frame to a picture control, you get more flexibility in this regard.  It's still a container, you could add your own rectangle around it with an overlapping label, and you can add pictures, etc.
Hi harishsc,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Split points between: bobbit31 and glass_cookie

harishsc, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with my recommendation, please post an explanatory comment.
DanRollins -- EE database cleanup volunteer
Richie_SimonettiIT OperationsCommented:
Fine to me.
Points reduced for split and comment accepted as answer.  The other expert can look for their question in this topic area

E-E Moderator
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.