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









share|improve this question
























  • 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















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









share|improve this question
























  • 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













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









share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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


















  • 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

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














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





















































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







Popular posts from this blog

'app-layout' is not a known element: how to share Component with different Modules

android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

WPF add header to Image with URL pettitions [duplicate]