Results 1 to 1 of 1

Thread: vba help- copy excel worksheet to word by browsing for excel file

  1. #1

    vba help- copy excel worksheet to word by browsing for excel file

    I would like to copy a sheet from an excel file to word . I would like to place the first sheet from the excel at a bookmark location in word.
    I want to browse for the file from word and select the file and then paste it at the bookmark.

    Private Sub CommandButton4_Click()
    Dim FileToOpen As Variant
    Dim OpenBook As Excel.Workbook
    Application.ScreenUpdating = False
    FileToOpen = Application.getopenfilename(Title:="Browse for your File & Import overlay", FileFilter:="Excel Files (*.xls*),*xls*")
    If FileToOpen <> False Then
    Set OpenBook = Application.Workbooks.Open(FileToOpen)
    ActiveDocument.Bookmarks("srspic").PasteSpecial xlPasteValues
    OpenBook.Close False

    End If
    Application.ScreenUpdating = True
    End Sub

    for some reason, i get user type not defined error at excel.workbook.
    i have enabled microsoft office 16 object library in references.

    I would appreciate any help!

    I have attached the excel file for reference, I want to copy the overlay sheet from excel to word .
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts