Consulting

Results 1 to 2 of 2

Thread: Help o kind sir/madam! copy excel sheet to word by browsing for excel file from word

  1. #1

    Help o kind sir/madam! copy excel sheet to word by browsing for excel file from word

    hello!
    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)
    OpenBook.Sheets(1).Copy
    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!
    thanks!

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

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,174
    Location
    Kindly don't post the same question multiple times.

    Kindly post inter-op questions in the correct forum.

    Kindly use the code tags when posting code.

    Thread closed.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

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