PDA

View Full Version : Solved: Hyperlink to PDF file gives error 432



vodkasoda
07-14-2010, 05:29 AM
I have an Excel VBA program that executes the following line ...

ThisWorkbook.FollowHyperlink MyNews

... unfortunately this is giving me a Run-time error 432 - "File name or class name not found during automation process"

The Variable MyNews is a valid and correct address (E:\VULCANO\Newsletter S9.pdf). I can open this file directly by clicking on it and it opens in Acrobat Reader 9.

This program and this line has worked perfectly OK for ages, but I have recently rebuilt my Windows Vista system (only the C: Drive, where the OS is based) and upgraded from Office 2003 to Office 2007 and it now doesn't work.

So, have I missed something in my rebuild, have I forgotten to do something to associate this line with a PDF file in my VBA program, is there something different in 2007 compared to 2003, or is it something completely different ?!?

Help :dunno !!!!!

austenr
07-14-2010, 09:35 AM
might help if we saw the rest of the code?

vodkasoda
07-14-2010, 09:58 AM
might help if we saw the rest of the code?

Not sure what else I can give you that's relevant, it's a huge program that does all kind of things, but none of them are relevant to this problem !!!

What I can say is that where I have a similar line, but the file is NOT PDF, it works fine, so I'm wondering if it's something to do with Acrobat Reader ...

:Thinkingo

austenr
07-14-2010, 10:06 AM
This help:

Sub OpenPDFdoc()
MsgBox "This will fail if you don't have Adobe Acrobat installed :o)"
On Error Goto 1
ActiveWorkbook.FollowHyperlink ActiveWorkbook.Path & _
"\AA cover.pdf", NewWindow:=True
Exit Sub
1: MsgBox Err.Description
End Sub

Kenneth Hobs
07-14-2010, 11:26 AM
That error is common if the file does not exist. Use fso or the DIR() function to determine if it exists before you use a command that might fail.

vodkasoda
07-14-2010, 12:01 PM
Thanks for your help everybody, and Kenneth, I know that the file is there at that point in time because it is only when the file exists that the hyperlink is created ...

Anyway, I read somewhere that it can be caused by the registry having pointers to different versions of Acrobat Reader, so I uninstalled version 9, went through the Registry & deleted all references to Acrobat Reader and re-installed version 9 ... and now it works !!!

So many unnecessary problems are caused by this MS Registry system, superfluous and unremoved pointers :soupbox: !!!!!

Kenneth Hobs
07-14-2010, 12:52 PM
Glad you solved it. Please mark thread solved.

While the common problem is a missing file, the other is a problem with the registry. An error routine like this can help troubleshoot some errors.

On Error GoTo ErrMsg
ThisWorkbook.FollowHyperlink "c:\myfiles\pdf\ken.pdf"

Exit Sub
ErrMsg:
Dim Msg As String
If Err.Number <> 0 Then
Msg = "Error # " & Str(Err.Number) & " was generated by " _
& Err.Source & Chr(13) & Err.Description
MsgBox Msg, , "Error", Err.HelpFile, Err.HelpContext
End If