Solved

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

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

This article describes how to use the Send to Mail Recipient command. The instructions apply generally to Office 2007 and later versions, but Microsoft® Word 2013 was used for the specific steps and figures.  What is Send to Mail Recipient? Send…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…

770 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