PDA

View Full Version : Insert Object



stapuff
06-09-2005, 10:41 AM
Can a object be inserted into a userform?

I have an object =Embed("PersonalCommunications.4.2","") on a sheet. I would like to put this on a userform.


Thanks,


Kurt

MOS MASTER
06-09-2005, 11:32 AM
Hi Kurt, :yes

Well it depends on what you wish to do with the embeded object?

If you just want to show it you could use a Webbrowser control instead and have it load your document.

So put a webbrowser control on a userform and put code in it like this: (to test put the
PersonalCommunications.xls to download into the same directory as test document)
Private Sub UserForm_Initialize()
Dim sFile As String
sFile = ThisWorkbook.Path & Application.PathSeparator & "PersonalCommunications.xls"
Me.WebBrowser1.Navigate (sFile)
End Sub


If you want it to be editable to retain changes made in the userform you will need a Ole Container Control. Downfall: Excel doesn't have such a control (Access does) so that is no option I think.

Try the Webcontrol (Toolbox/Right click/More Controls/Microsoft Web browser)

Enjoy! :whistle: