This is actually curious. Let me try to explain what is happening. I wrote a macro in a word that calls an excelfile macro
Set excel = CreateObject("excel.application")
excel.Visible = True
excel.workbooks.Open FileName:=tablePath
IDcolumn = excel.Application.Run("main", generatedExelPath)
The "main" function, called from the word macro, "simply" generates a new excel file, copying certain data from the called excel file.
So, we got 1 word and 2 Excel documents. some sheets of excel1 must be copied to excel2.
so i use:
For i = 0 To UBound(copySheets)
Windows(srcWinName).Activate
Sheets(copySheets(i)).Activate
Set AcSh = ActiveSheet
Windows(destWinName).Activate
If copySheets(i) = "config" Then
AcSh.Copy Before:=Sheets(1)
Else
AcSh.Copy After:=ActiveSheet
End If
Next i
where copySheets contains the sheets to be copied. But copy commands cause an error. Something like “can't copy from source to target because the destination has fewer rows and columns than the original file”
Atm excel1 xlsm, xls, .
, , excel2, -
Workbooks.Add Template:="Workbook"
, , , .
xlsm, , open this empty xlsm
. , - .
Ahh, : excel, , ,
Word excel, .
:
excel, . .
, , . format: Orb > Excel > | | > : " Excel (.xlsx)". Excel 97-2003 (.xls). - 29 12:09