这是我的代码,用于将PDF复制并粘贴到Excel工作表中。
但是!导入PDF后,Excel中将有一个日期值。 PDF中的日期为02/01/2019,而在Excel中为01/02/2019。 我认为这是格式问题?但是,在导入无用之后,将“ 01/02/2019”更改为日期……这仍然是错误的日期。
Option Explicit
Sub pdf_to_excel_adobe()
Dim myWorksheet As Worksheet
Dim adobeReaderPath As String
Dim pathAndFileName As String
Dim shellPathName As String
Set myWorksheet = ActiveWorkbook.Worksheets("Adobe Reader")
myWorksheet.Cells.Clear
adobeReaderPath = "C:\AcroRd32.exe"
pathAndFileName = "Z:\TS.pdf"
shellPathName = adobeReaderPath & " """ & pathAndFileName & """"
Call Shell( _
pathname:=shellPathName, _
windowstyle:=vbNormalFocus)
Application.Wait Now + TimeValue("0:00:03")
SendKeys "%vpc"
SendKeys "^a"
SendKeys "^c"
Application.Wait Now + TimeValue("0:00:30")
Windows("NTT.xlsm").Activate
ActiveWorkbook.Worksheets("Adobe Reader").Activate
Range("A1").Select
ActiveSheet.Paste
Call Shell("TaskKill /F /IM AcroRd32.exe", vbHide)
End Sub