Étiquette : application_integration

  • Some Examples with Excel VBA

    Let us begin with the task of preparing a Word document that contains a list and examples of laboratory assignments for the course “Applied and Integrated Packages”, formatted as a table that includes embedded objects (MS Excel workbooks) displayed as icons.

    To prepare such a document, follow the recommendations below:

    • Create a new Word document and add a title for the table.
    • Design the table layout and add information to the table header and columns: No., Topic.
    • To embed objects into the File Example column so that they appear as icons, go to the Insert tab of the ribbon, in the Text group, click the arrow on the Object button, and select the Object command.
    • In the Object dialog box, on the Create from File tab, specify the file location in the File name field, check the Display as icon option, use the Change Icon button to select an appropriate icon, and add a caption.
    • Format the completed table and save your prepared document.

    Now let us look at preparing a Word document titled “Summary Table Report”, which contains a table with data from an Excel workbook .

    Steps for preparing this document:

    • Prepare the Word document (client): enter the necessary text information and leave space for the Excel table.
    • Prepare the Excel document (server) according:

     , using a formula to calculate the average value.

    • Select the prepared table in the Excel document, go to the Home tab of the ribbon, and in the Clipboard group, click Copy.
    • Switch to Word and place the cursor at the insertion point for the linked data.
    • On the Home tab of the ribbon, in the Clipboard group, click the arrow on the Paste button and select Paste Special.
    • In the dialog box that appears, set the necessary options and click OK.

    • Save the resulting Word document.

    TIP
    When working with a linked object in a client document, it is convenient to use its context menu .

  • Embedding Data from Other Applications with Excel VBA

    Microsoft Office 2010 applications also provide the ability to embed data into a document from any server application that supports the OLE technology.

    After embedding, the data becomes part of the specific Microsoft Office 2010 application document. When such data is edited, the server application is launched from within the client application. The inserted object is saved together with the document file, and editing it does not affect the original file.

    Once the server application is loaded from the client application, the embedded object can be viewed and processed while simultaneously seeing the document into which the object has been embedded. This capability is called in-place activation.

    Embedding an object into a Microsoft Office Word 2010 document can be done in two ways:

    • Using the Object dialog box, which allows the embedded object to be created directly in the client application:
      • On the Create New tab, you can select the embedded object by the type of server application.
      • On the Create from File tab, you can select the embedded object as a file.

    NOTE
    In this case, in the Object dialog box, the Link to file option should not be selected.

    • By copying from the document in which the object already exists.

    Inserting embedded objects into a Microsoft Office 2010 document is done through two types of applications:

    • Any server applications that support OLE.
    • Add-ins that come with Microsoft Office 2010. Add-ins are not standalone applications and can only be used from within a client application.

    Windows applications that only partially support OLE may not appear in the Object dialog box. However, it is possible to embed such objects in one of the following ways:

    • Perform a copy in the server application document.
    • In the client application, go to the Home tab of the ribbon, and in the Clipboard group, click the arrow on the Paste button, then select the Paste Special command from the list.
  • Data Linking with Excel VBA

    If you need to use data linking technology in a document, Microsoft Office applications provide two ways to do this:

    • By using a remote reference formula, which can be entered from the keyboard or inserted into the document with the Paste Special command, chosen from the list that appears when you click the arrow on the Paste button in the Clipboard group on the Home tab of the ribbon.
    • By using macros that control Dynamic Data Exchange (DDE).

    Many Microsoft Office applications can receive data from other applications in the suite, and when the data changes in the server application, it is automatically updated in the client application.

    You can choose how the linked data will be updated: automatically or manually. If updates are performed manually, the linked applications run faster.

    To link, for example, a Microsoft Office Word 2010 client document to another application, follow these steps:

    • Open the Word client document and the server application.
    • Activate the server application, i.e., switch to it.
    • Select the data to be linked.
    • On the Home tab of the ribbon, in the Clipboard group, click Copy.
    • Activate the Word client document and place the cursor where the linked data should be inserted.
    • On the Home tab of the ribbon, in the Clipboard group, click the arrow on the Paste button and select Paste Special.
    • In the Paste Special window that opens, select the Link option, choose the linking method from the As list, and click OK.

    TIP
    When working with Microsoft Office documents, it is convenient to use hyperlinks.

    You can also link a Word 2010 client document to another application by using the Object insertion window. To do this, go to the Insert tab of the ribbon, in the Text group, click the arrow on the Object button, and select Object. In the Object window that opens, go to the Create from File tab .

    In the File name field, specify the location of the server application (using the Browse button if necessary), and check the boxes for Link to file and Display as icon. You can also choose an appropriate icon to be displayed in the document by using the Change Icon button.

    As a result, your document will contain an icon, and clicking it will open the corresponding server application.

    NOTE
    If in the Object window on the Create from File tab you select only the Link to file checkbox, then the content of the server document will be displayed in the client document.

    Clicking it will open the server document.

    For Microsoft Office applications, you can specify the data update mode: go to the File tab of the ribbon and click Options. In the window that opens, select the Advanced category on the left, and in the General group on the right, check the Update automatic links at open option.

    NOTE
    When inserting images into a document using the Insert Picture window (go to the Insert tab of the ribbon and in the Illustrations group click Picture), you can also configure the link between the Word document and the graphic file: in the Insert Picture window, click the arrow on the Insert button and select the desired command.