Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2015-01-20
4
Medium Priority
?
446 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 15

Expert Comment

by:DrTribos
ID: 40561425
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
ID: 40561447
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
ID: 40561532
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
ID: 40569023
found a solution myself
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a serious pitfall that can happen when deleting shapes using VBA.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

916 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