Sub 将txt文件内容复制到剪贴板粘贴到excel()
Pn = "C:\Users\Administrator\Desktop\TenpayRegInfo\TenpayRegInfo.txt" 'txt文件名及路径
Shell "notepad.exe " & Pn, 1 '用记事本打开文件
Application.Wait Now + TimeValue("00:00:01") '暂停1秒等待文件打开完毕(大文件用)
SendKeys "^a", True '全选文本
SendKeys "^c", True '复制到剪贴板
SendKeys "%{F4}", True '关闭txt文件
Application.Wait Now + TimeValue("00:00:01") '暂停1秒等待文件打开完毕(大文件用)
ThisWorkbook.Activate
Range("A1").Select
ActiveSheet.Paste
End Sub
将txt文件内容复制到剪贴板粘贴到excel
于 2021-12-07 08:32:16 首次发布