Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VIEWING A PDF WITHIN VB

Status
Not open for further replies.

PrgrmsAll

Programmer
Apr 8, 2003
180
US
I have my form set up with a webBrowser control and I am trying to set the .Navigate2 proprty to be the location of a PDF file on the root of C (C:\Sample.pdf). Although I can navigate my IE to this file and open it successfully, I am unable to get the webBrowser object to display the file.

The error message I am receiving is "Invalid Procedure Call or Argument."

Here's the code I am using:

txtContractLoc = "C:\Sample.pdf"
WebBrowser.Navigate2 txtContractLoc

 
Works OK here - is your webbrowser control actually called WebBrowser? The default name is WebBrowser1

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
the default is webbrowser1, i renamed it webbrowser. still not working. weird.
 

WB.Navigate "file:///C:/Sample.pdf"

or nav2 if you wish

Good Luck

 
or...

Dim txtContractLoc As String
txtContractLoc = "C:\Sample.pdf"
WB.Navigate txtContractLoc


Have Fun, Be Young... Code BASIC
-Josh
cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Wouldn't it be easier to use the Acrobat Ocx ?

Me.Pdf1.LoadFile Me.AcrobatPath

Pdf1 is the control
AcrobatPath is a text with the path as text.

 
What is the OCX called?

... or do you have to have Acrobat, and not just the viewer?



Have Fun, Be Young... Code BASIC
-Josh
cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top