|
- Sub wrtInTxt()
- Dim oClp As Object
- Dim Flnm, Str$, k%, Txtnm$
- Dim Wb As Workbook, Pth$
- Set oClp = CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
- Flnm = Application.GetOpenFilename("Excel文件,*.xls", , "请选择", , True)
- Txtnm = InputBox("请输入你想保存的文本名称:")
- For k = 1 To UBound(Flnm)
- Set Wb = GetObject(Flnm(k))
- Wb.Sheets(1).[A6].CurrentRegion.Copy '此处假设所有文件格式相同
- oClp.getfromclipboard: Str = oClp.gettext
- Pth = Wb.Path
- [A1].Copy: Wb.Close 0
- Open Pth & "" & Txtnm & ".txt" For Append As #1
- Print #1, Str: Reset
- Next
- Set oClp = Nothing
- MsgBox "数据已写入文本中。"
- End Sub
复制代码 |
|