I have a workbook testandclose .xlsm where sheets master copies a template format :c:\\sample \intermartformat by using the code below.
That is it opens the interformat,xlsx , copy , paste in active workbook and close the interformat sheet.
but I am getting a runtime error 1004.as in bold red below.
Can anyone assist
![]()
Sub Add_Bridge_1WORKINGSFORMAT() Dim wbk1 As Workbook, wbk2 As Workbook Dim fileStr As String 'add your own file path fileStr = "c:\\sample\INTERMARTFORMAT.xlsx" Set wbk1 = ActiveWorkbook 'Set wbk2 = Workbooks.Add(fileStr) Set wbk2 = Workbooks.Open(fileStr) wbk2.Activate wbk2.Sheets("WORKINGS").Copy After:=wbk1.Sheets("MASTER") 'places the copied sheet after Sheet3 in the master book. Change "Sheet3" to Workbooks("INTERMARTFORMAT.xlsx").Close False End Sub
Bookmarks