Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default How to load a PDF using Excel VBA

How to load a PDF using Excel VBA? Can anyone give sample code

Many thanks in advance!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default How to load a PDF using Excel VBA

Hi
what do you mean with 'load PDF'. Note: Its not so easy to convert a
PDF document back to an Excel file format (has nothing to do with VBA)

--
Regards
Frank Kabel
Frankfurt, Germany


James wrote:
How to load a PDF using Excel VBA? Can anyone give sample code?

Many thanks in advance!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default How to load a PDF using Excel VBA

I mean, I got a PDF file. I want to use Excel VBA to open that PDF in Acrobat Reader. Just like when you double-click a PDF using the mouse

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default How to load a PDF using Excel VBA

I tried before I submit the question. Failed

But thanks anyway. :

----- Dave Peterson wrote: ----

Ahhh

maybe something like

Shell "start myfile.pdf

James wrote
I want to open the PDF in Acrobat Reader, not importing it into Excel. But use Excel VBA
----- Dave Peterson wrote: ----

You could search google for pdf translators (to excel or to text files). Mos

are commercial ($)
You might get lucky and be able to copy each column and paste into excel (colum

by column)--from Adobe Reader
James wrote
I mean, I got a PDF file. I want to use Excel VBA to open that PDF in Acrobat Reader. Just like when you double-click a PDF using the mouse

-
Dave Peterso




--

Dave Peterso


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default How to load a PDF using Excel VBA

I could not get this to work until I included the full path and name of the
Adobe Acrobat reader in the command along with the desired file name.
Apparently, Shell passes the whole string directly to the command engine
without looking up the association in the registry. This could be a problem
if you are going to try to run this on a variety of machines, since the
Adobe Reader may be in different subdirectories on every machine.

Shell "C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe C:\My
Documents\Test Page.pdf", _
vbNormalFocus

(You can replace the vbNormalFocus with vbMaximizedFocus or whatever value
you want for the window style.)
--
Regards,
Bill


"James" wrote in message
...
I tried before I submit the question. Failed.

But thanks anyway. :

----- Dave Peterson wrote: -----

Ahhh.

maybe something like:

Shell "start myfile.pdf"

James wrote:
I want to open the PDF in Acrobat Reader, not importing it into

Excel. But use Excel VBA.
----- Dave Peterson wrote: -----
You could search google for pdf translators (to excel or to

text files). Most
are commercial ($).
You might get lucky and be able to copy each column and paste

into excel (column
by column)--from Adobe Reader.
James wrote:
I mean, I got a PDF file. I want to use Excel VBA to open that

PDF in Acrobat Reader. Just like when you double-click a PDF using the
mouse.
--
Dave Peterson




--

Dave Peterson






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default How to load a PDF using Excel VBA

Hi James
o.k. that's simple :-)
have a look at the VBA Shell method. e.g.
Shell "mypdffile.pdf"

--
Regards
Frank Kabel
Frankfurt, Germany


James wrote:
I mean, I got a PDF file. I want to use Excel VBA to open that PDF in
Acrobat Reader. Just like when you double-click a PDF using the
mouse.


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default How to load a PDF using Excel VBA

"Frank Kabel" wrote:
<<Shell "mypdffile.pdf"

Does this really work on your machine? I had trouble with this (Win ME and
Excel 2000 SP-3).
(See my post about an hour before yours.)
(Need to resynchronize your newsreader every 15 minutes or so?)
--
Regards,
Bill


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default How to load a PDF using Excel VBA

Chip Pearson posted an API solution to find the executable (modified very
slightly for pdf):

Option Explicit

Declare Function GetTempFileName Lib "kernel32" _
Alias "GetTempFileNameA" ( _
ByVal lpszPath As String, _
ByVal lpPrefixString As String, _
ByVal wUnique As Long, _
ByVal lpTempFileName As String) As Long

Declare Function FindExecutable Lib "shell32.dll" _
Alias "FindExecutableA" ( _
ByVal lpFile As String, _
ByVal lpDirectory As String, _
ByVal lpResult As String) As Long

Sub AAA()

Dim FName As String
Dim FNum As String
Dim ExeName As String
Dim Res As Long
FName = String$(255, " ")
ExeName = String$(255, " ")
Res = GetTempFileName(CurDir, "", 0&, FName)
FName = Application.Trim(FName)
Mid$(FName, Len(FName) - 2, 3) = "pdf"
FNum = FreeFile
Open FName For Output As #FNum
Close #FNum
Res = FindExecutable(FName, vbNullString, ExeName)
Kill FName
If Res 32 Then
' association found
ExeName = Left$(ExeName, InStr(ExeName, Chr(0)) - 1)
Else
' no association found
ExeName = ""
End If
MsgBox ExeName

End Sub



Bill Renaud wrote:

I could not get this to work until I included the full path and name of the
Adobe Acrobat reader in the command along with the desired file name.
Apparently, Shell passes the whole string directly to the command engine
without looking up the association in the registry. This could be a problem
if you are going to try to run this on a variety of machines, since the
Adobe Reader may be in different subdirectories on every machine.

Shell "C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe C:\My
Documents\Test Page.pdf", _
vbNormalFocus

(You can replace the vbNormalFocus with vbMaximizedFocus or whatever value
you want for the window style.)
--
Regards,
Bill

"James" wrote in message
...
I tried before I submit the question. Failed.

But thanks anyway. :

----- Dave Peterson wrote: -----

Ahhh.

maybe something like:

Shell "start myfile.pdf"

James wrote:
I want to open the PDF in Acrobat Reader, not importing it into

Excel. But use Excel VBA.
----- Dave Peterson wrote: -----
You could search google for pdf translators (to excel or to

text files). Most
are commercial ($).
You might get lucky and be able to copy each column and paste

into excel (column
by column)--from Adobe Reader.
James wrote:
I mean, I got a PDF file. I want to use Excel VBA to open that

PDF in Acrobat Reader. Just like when you double-click a PDF using the
mouse.
--
Dave Peterson



--

Dave Peterson



--

Dave Peterson

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default How to load a PDF using Excel VBA

Are you sure that the pc has Reader installed?

Another option (also worked for me):

ActiveWorkbook.FollowHyperlink "c:\myfolder\myfile.pdf"

(Did you include the complete path when you tested the Start suggestion?)



James wrote:

I tried before I submit the question. Failed.

But thanks anyway. :

----- Dave Peterson wrote: -----

Ahhh.

maybe something like:

Shell "start myfile.pdf"

James wrote:
I want to open the PDF in Acrobat Reader, not importing it into Excel. But use Excel VBA.
----- Dave Peterson wrote: -----
You could search google for pdf translators (to excel or to text files). Most

are commercial ($).
You might get lucky and be able to copy each column and paste into excel (column

by column)--from Adobe Reader.
James wrote:
I mean, I got a PDF file. I want to use Excel VBA to open that PDF in Acrobat Reader. Just like when you double-click a PDF using the mouse.
--
Dave Peterson




--

Dave Peterson



--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP!!!! New PC and can't load excel welovezig Setting up and Configuration of Excel 1 September 6th 05 10:18 PM
how do i load excel terry Setting up and Configuration of Excel 1 February 23rd 05 08:14 PM
Excel won't load Mike Excel Discussion (Misc queries) 2 January 28th 05 04:51 PM
Excel XP will not load Mike Setting up and Configuration of Excel 0 January 22nd 05 08:43 PM
How to use Excel C API to load an XLL add-in? Michael[_18_] Excel Programming 0 October 9th 03 03:41 AM


All times are GMT +1. The time now is 10:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"