Solved

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

Posted on 2015-01-20
4
277 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

895 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

16 Experts available now in Live!

Get 1:1 Help Now