lezawang
Well-known Member
- Joined
- Mar 27, 2016
- Messages
- 1,805
- Office Version
- 2016
- Platform
- Windows
Hi
I am trying to merge 2 different files. The first file is hello1.xlsm (workbook1) in which i wrote the vba code below. hello1.xlsm is saved in the same folder of the second file which I want to merge it with, the second file called abc.xlsx. I got run time error - "method "mergeworkbook' of object _workbook failed". Any help would be very much appreciated.
I followed this article
https://docs.microsoft.com/en-us/office/vba/api/excel.workbook.mergeworkbook
I am trying to merge 2 different files. The first file is hello1.xlsm (workbook1) in which i wrote the vba code below. hello1.xlsm is saved in the same folder of the second file which I want to merge it with, the second file called abc.xlsx. I got run time error - "method "mergeworkbook' of object _workbook failed". Any help would be very much appreciated.
Code:
Sub workbookmerge()
Workbooks(1).MergeWorkbook "abc.xlsx"
End Sub
I followed this article
https://docs.microsoft.com/en-us/office/vba/api/excel.workbook.mergeworkbook
Last edited: