Solved

VBA - word, is it possible to embed a document into a useform?

Posted on 2015-01-20
4
255 Views
Last Modified: 2015-01-25
Hi guys, is it possible to embed a document into a userform?

I do know how to link a document from a destination, but i would very much like to embed a Excel document directly into a userform.

is there a way, and how to?

thank you in advance
0
Comment
Question by:Hakum
  • 3
4 Comments
 
LVL 14

Expert Comment

by:DrTribos
Comment Utility
I don't think it is possible. If you create a user form you can export the userform as a file and look at the structure of the file.

I don't think you can readily add extra information to the file.

How are you planning on retrieving / using the document?
0
 
LVL 1

Author Comment

by:Hakum
Comment Utility
what i want to achieve with this is basically, from the userform in word click on a button which opens up the embedded excel document, the user will now do the calculation / use various formulas which are in the excel document, and manually insert the data into the word userform from excel( since its not possible to make the word userform to calculate and use formula's). I only want to distribute one single file, since some people use it locally without connection to the network so i cant even save the excel file on a network location.

sorry for my poor english
0
 
LVL 1

Accepted Solution

by:
Hakum earned 0 total points
Comment Utility
Hi again,

I guess I wasn't asking the correct question when i was Google'ing :)

I found a way to open up embeded files in word

here is the code i used, i have commented out the msg box

Sub Open_embed()

    Dim num As Integer
    Dim AD As Document
    Set AD = ActiveDocument

    Dim numObjects As Integer
    numObjects = AD.InlineShapes.Count
    
    'MsgBox numObjects  ' prints "11"

    For num = 1 To numObjects
        If AD.InlineShapes(num).Type = 1 Then
            'it's an embedded OLE type so open it.
            AD.InlineShapes(num).OLEFormat.Open

        End If
    Next num

End Sub

Open in new window

0
 
LVL 1

Author Closing Comment

by:Hakum
Comment Utility
found a solution myself
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now