I am trying to open a PDF file in a certain way through VBA by calling a command prompt. I have each individual part working, but can't put them together!
I can call the command prompt:
I also know the two commands I want to go in the prompt (I'd love to turn this into one command instead of two but I'm not sure how to do it, or if it is even possible plus I presume that is a question for a different forum!):
The DOS command opens a particular PDF (allegro) on page 10.
I cannot figure out the code however to get VBA to put the commands in the command prompt, execute them and then close the command prompt window.
To complicate things further, the PDF document and page number needs to change dependent on the values in and around the active cell when I run the macro. For example if the value in the active cell (A4) is Whistle Down The Wind. Cell B4 has the value The Vault's Of Heaven. Cell C4 has the hidden value of 5 (which is the page number for The Vaults Of Heaven). In this example the commands to go into the command prompt would be:
So in other words I need parts of the command prompt command to be defined by the active cell when the macro is run.
Is any of this even possible?! My head is swimming just thinking about it, which I need to stop doing before I go crazy! I hope someone has a clue what I am talking about and if even a small part of it is possible!
James
I can call the command prompt:
Code:
Call Shell("cmd.exe " & dosCmd, vbNormalFocus)
Code:
cd c:\program files\adobe\acrobat 9.0
start acrobat.exe /A "page=10=Open Actions" "M:\My Books\allegro.pdf
I cannot figure out the code however to get VBA to put the commands in the command prompt, execute them and then close the command prompt window.
To complicate things further, the PDF document and page number needs to change dependent on the values in and around the active cell when I run the macro. For example if the value in the active cell (A4) is Whistle Down The Wind. Cell B4 has the value The Vault's Of Heaven. Cell C4 has the hidden value of 5 (which is the page number for The Vaults Of Heaven). In this example the commands to go into the command prompt would be:
Code:
cd c:\program files\adobe\acrobat 9.0
start acrobat.exe /A "page=5=Open Actions" "M:\My Books\Whistle Down The Wind.pdf
Is any of this even possible?! My head is swimming just thinking about it, which I need to stop doing before I go crazy! I hope someone has a clue what I am talking about and if even a small part of it is possible!
James