Set xlTagBook = xlCopyApp.Workbooks.Open(strTagWorkbook)
End If
Set ExcelSource = xlSrcBook.Worksheets(strSrcSheetName)
Set ExcelTarget = xlTagBook.Worksheets(strTagSheetName)
ExcelSource.Select
ExcelSource.Cells.Copy
ExcelTarget.Select
ExcelTarget.Paste
xlCopyApp.Application.CutCopyMode = xlCopy
If strSrcWorkBook = strTagWorkbook Then
xlTagBook.Save
xlSrcBook.Save
Else
xlTagBook.Save
End If
Set ExcelSource = Nothing
Set ExcelTarget = Nothing
Set xlSrcBook = Nothing
Set xlTagBook = Nothing
CopySheet = True
End If
End Function
'復制工作表
Function ExcelCopySheet(ByVal strSrcSheetName As String, ByVal strSrcWorkBook As String, ByVal strTagSheetName As String, ByVal strTagWorkbook As String, xlCopyApp As Excel.Application) As Boolean
Dim xlSrcBook As Excel.Workbook
Dim xlTagBook As Excel.Workbook
Dim ExcelSource As Excel.Worksheet
Dim ExcelTarget As Excel.Worksheet
Dim Result As Boolean
If CheckFile(strSrcWorkBook) = False Or CheckFile(strTagWorkbook) = False Then
Set ExcelSource = Nothing
Set ExcelTarget = Nothing
Set xlSrcBook = Nothing
Set xlTagBook = Nothing
CopySheet = False
Exit Function
Else
相關(guān)推薦:北京 | 天津 | 上海 | 江蘇 | 山東 |
安徽 | 浙江 | 江西 | 福建 | 深圳 |
廣東 | 河北 | 湖南 | 廣西 | 河南 |
海南 | 湖北 | 四川 | 重慶 | 云南 |
貴州 | 西藏 | 新疆 | 陜西 | 山西 |
寧夏 | 甘肅 | 青海 | 遼寧 | 吉林 |
黑龍江 | 內(nèi)蒙古 |