Paste PDF file with Pastespecial
up vote
0
down vote
favorite
Here is my code which is copying and paste a PDF Inside an Excel Sheet.
But ! After import the PDF, there is a date value in Excel.
It's 02/01/2019 in the PDF, and change to 01/02/2019 in excel.
I think it is a format problem ? But change the "01/02/2019" to date after the import is useless… it will still be the wrong date.
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
excel vba excel-vba pdf excel-2016
add a comment |
up vote
0
down vote
favorite
Here is my code which is copying and paste a PDF Inside an Excel Sheet.
But ! After import the PDF, there is a date value in Excel.
It's 02/01/2019 in the PDF, and change to 01/02/2019 in excel.
I think it is a format problem ? But change the "01/02/2019" to date after the import is useless… it will still be the wrong date.
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
excel vba excel-vba pdf excel-2016
Change the number format of the cell where you paste the date to "text" before you paste:Range(…).NumberFormat = "@"
– Pᴇʜ
yesterday
It doesn't change… ActiveWorkbook.Worksheets("Adobe Reader").Activate Range("A1").Select Range("A1").NumberFormat = "@" ActiveSheet.Paste.
– babou
yesterday
1
will the date be in A1? Or in another cell?
– Pᴇʜ
yesterday
An idiot mistake sorry… Thank you for your help, it works !
– babou
yesterday
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Here is my code which is copying and paste a PDF Inside an Excel Sheet.
But ! After import the PDF, there is a date value in Excel.
It's 02/01/2019 in the PDF, and change to 01/02/2019 in excel.
I think it is a format problem ? But change the "01/02/2019" to date after the import is useless… it will still be the wrong date.
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
excel vba excel-vba pdf excel-2016
Here is my code which is copying and paste a PDF Inside an Excel Sheet.
But ! After import the PDF, there is a date value in Excel.
It's 02/01/2019 in the PDF, and change to 01/02/2019 in excel.
I think it is a format problem ? But change the "01/02/2019" to date after the import is useless… it will still be the wrong date.
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
excel vba excel-vba pdf excel-2016
excel vba excel-vba pdf excel-2016
edited yesterday
asked yesterday
babou
12410
12410
Change the number format of the cell where you paste the date to "text" before you paste:Range(…).NumberFormat = "@"
– Pᴇʜ
yesterday
It doesn't change… ActiveWorkbook.Worksheets("Adobe Reader").Activate Range("A1").Select Range("A1").NumberFormat = "@" ActiveSheet.Paste.
– babou
yesterday
1
will the date be in A1? Or in another cell?
– Pᴇʜ
yesterday
An idiot mistake sorry… Thank you for your help, it works !
– babou
yesterday
add a comment |
Change the number format of the cell where you paste the date to "text" before you paste:Range(…).NumberFormat = "@"
– Pᴇʜ
yesterday
It doesn't change… ActiveWorkbook.Worksheets("Adobe Reader").Activate Range("A1").Select Range("A1").NumberFormat = "@" ActiveSheet.Paste.
– babou
yesterday
1
will the date be in A1? Or in another cell?
– Pᴇʜ
yesterday
An idiot mistake sorry… Thank you for your help, it works !
– babou
yesterday
Change the number format of the cell where you paste the date to "text" before you paste:
Range(…).NumberFormat = "@"
– Pᴇʜ
yesterday
Change the number format of the cell where you paste the date to "text" before you paste:
Range(…).NumberFormat = "@"
– Pᴇʜ
yesterday
It doesn't change… ActiveWorkbook.Worksheets("Adobe Reader").Activate Range("A1").Select Range("A1").NumberFormat = "@" ActiveSheet.Paste.
– babou
yesterday
It doesn't change… ActiveWorkbook.Worksheets("Adobe Reader").Activate Range("A1").Select Range("A1").NumberFormat = "@" ActiveSheet.Paste.
– babou
yesterday
1
1
will the date be in A1? Or in another cell?
– Pᴇʜ
yesterday
will the date be in A1? Or in another cell?
– Pᴇʜ
yesterday
An idiot mistake sorry… Thank you for your help, it works !
– babou
yesterday
An idiot mistake sorry… Thank you for your help, it works !
– babou
yesterday
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372687%2fpaste-pdf-file-with-pastespecial%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Change the number format of the cell where you paste the date to "text" before you paste:
Range(…).NumberFormat = "@"
– Pᴇʜ
yesterday
It doesn't change… ActiveWorkbook.Worksheets("Adobe Reader").Activate Range("A1").Select Range("A1").NumberFormat = "@" ActiveSheet.Paste.
– babou
yesterday
1
will the date be in A1? Or in another cell?
– Pᴇʜ
yesterday
An idiot mistake sorry… Thank you for your help, it works !
– babou
yesterday