Copy a userform to a different workbook with VBA
Bob,
Sure - here it is, but it is nearly identical to your code.
1 Sub copyForm()
2 Dim targetFile As String
3 targetFile = "EK-Prices"
4 ThisWorkbook.VBProject.VBComponents("FImport").Exp ort
Filename:="C:\temp.frm"
5 Workbooks(targetFile).VBProject.VBComponents.Impor t
Filename:="C:\temp.frm"
6 Kill "C:\temp.frm"
7 End Sub
The error occurs in line 4: Runtime Error 1004.
Thanks,
Kuhni
|