For Each oTable In .Tables '在表格中循环 L = L + 1 With oTable Set rngCell = .Cell(2, 1).Range rngCell.SetRange rngCell.Start, rngCell.End - 1 myArray(L, 0) = rngCell.Text '序值 Set rngCell = .Cell(1, 3).Range rngCell.SetRange rngCell.Start, rngCell.End - 1 myArray(L, 1) = rngCell.Text '文件号值 Set rngCell = .Cell(2, 3).Range rngCell.SetRange rngCell.Start, rngCell.End - 1 myArray(L, 2) = rngCell.Text '文件名值 Set rngCell = .Cell(3, 3).Range rngCell.SetRange rngCell.Start, rngCell.End - 1 myArray(L, 3) = rngCell.Text '发文单位值 Set rngCell = .Cell(3, 5).Range rngCell.SetRange rngCell.Start, rngCell.End - 1 myArray(L, 4) = rngCell.Text '收文单位值 Set rngCell = .Cell(4, 3).Range rngCell.SetRange rngCell.Start, rngCell.End - 1 myArray(L, 5) = rngCell.Text '领导批示值 End With Next End With Set xlApp = CreateObject("Excel.Application") '创建一个Excel对象 xlApp.Visible = True '对象可见 Set xlBook = xlApp.Workbooks.Add Set xlSheet = xlApp.Worksheets(1) '为区域赋值 xlSheet.Range(xlSheet.Cells(1, 1), xlSheet.Cells(N + 1, 6)).Value = myArray End Sub '---------------------- 见附件:
cCJwH9ey.rar
(10.79 KB, 下载次数: 305)
|