Solved

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

Posted on 2015-01-20
4
342 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

726 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