We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Sub AddCSR() Dim FullFile As Variant Dim work_book As Workbook Dim last_sheet As Worksheet, WS As Worksheet Dim OLEWd As OLEObject Dim wdBM As Bookmark Dim WD As Word.Document Application.ScreenUpdating = False Set work_book = Application.ActiveWorkbook Set last_sheet = work_book.Sheets(work_book.Sheets.Count) Set WS = work_book.Sheets.Add(After:=last_sheet) WS.Name = "CSR1" FullFile = Application.GetOpenFilename _ (" WORD files(*.doc),*doc", 1, "SELECT and OPEN the CSR1 File", , False) If VarType(FullFile) = vbBoolean Then MsgBox "No File Specified", vbExclamation Exit Sub End If With OLEWd Set OLEWd = ActiveSheet.OLEObjects.Add(Filename:=FullFile, Link:=False, DisplayAsIcon:=False) 'OLEWd.Verb xlVerbOpen OLEWd.Name = "CSR1" OLEWd.Width = 400 OLEWd.Height = 800 OLEWd.Top = 30 OLEWd.Left = 0 Set WD = OLEWd.Object End With With OLEWd Set OLEWd = ActiveSheet.OLEObjects.Add(Filename:=FullFile, Link:=False, DisplayAsIcon:=False) OLEWd.Verb xlVerbOpen Selection.GoTo What:=wdGoToBookmark, Name:="Text26" Selection.Bookmarks(wdBM).Delete Selection.Bookmarks("\Page").Range.Delete OLEWd.Name = "CSR2" OLEWd.Width = 400 OLEWd.Height = 800 OLEWd.Left = 500 OLEWd.Top = 30 Set WD = OLEWd.Object End With Set WS = Nothing Set FullFile = Nothing Set OLEWd = Nothing Application.ScreenUpdating = True End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.