[Solved] Inserting a Word document

RichardSC

New member
Dear Members,
Is it possible to insert a Word document as a tab within an Excel workbook without imbedding, attaching or otherwise involving a new or existing Excel sheet?
I am using Excel for iMac 16.78 and Word for iMac 16.72 running on a 27" 2019 iMac updated to macOS Sonoma 14.1.1.
RichardSC
 
Dear Members,
Is it possible to insert a Word document as a tab within an Excel workbook without imbedding, attaching or otherwise involving a new or existing Excel sheet?
I am using Excel for iMac 16.78 and Word for iMac 16.72 running on a 27" 2019 iMac updated to macOS Sonoma 14.1.1.
RichardSC
Hello Richard

Welcome to ExcelDemy Forum. Thanks for reaching out and sharing your problem. Without embedding, you wanted to insert a Word Document as a tab within an Excel Workbook. That is not entirely possible in Excel. However, I am presenting an idea which will fulfil your requirements in another way (by creating a customized tab and a sub-procedure).

OUTPUT OVERVIEW:
Opening Word Document from customize tab.gif​

Follow these steps:

Step 1: Press Alt+F11 to open the VBA Editor window => Hover over Insert => Click on Module => Paste the following code in the module => Save.
Code:
Sub OpenWordDocument()
   
    Dim wordApp As Object
    Dim wordDoc As Object
    Dim filePath As String

    filePath = "C:\Users\User\Downloads\RichardSC FORUM\Richard Document.docx"

    Set wordApp = CreateObject("Word.Application")

    wordApp.Visible = True

    On Error Resume Next
    Set wordDoc = wordApp.Documents.Open(filePath)
    On Error GoTo 0

    If Not wordDoc Is Nothing Then
        MsgBox "Word document opened successfully!", vbInformation
    Else
        MsgBox "Failed to open Word document. Please check the file path.", vbExclamation
    End If

    Set wordDoc = Nothing
    Set wordApp = Nothing

End Sub
Hover over Insert, click on Module and paste the given code in module.png​

Step 2: Now create a customized tab like the following GIF.
Create customize tab like the following GIF.gif​

Step 3: Return to the workbook=> Go to the Open Document tab => Click on the OpenWordDocument command to see the result.
Return to the workbook, go to the Open Document tab and click on the OpenWordDocument command.png​

Hopefully, this idea will help you reach your goal. Good luck!

Regards
Lutfor Rahman Shimanto
ExcelDemy
 

Online statistics

Members online
1
Guests online
248
Total visitors
249

Forum statistics

Threads
464
Messages
2,084
Members
5,854
Latest member
Gamebaidoi1vn1
Back
Top