Open PDF-File with VBA

Started by Jumpy, February 23, 2010, 11:45:12 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jumpy

Hello,
I want to open a PDF-File from my Shape but can't use Hyperlinks because the filename can change.
The shapes represent machines and the PDF the handbook.

My idea is to start a VBA-Macro from a Action cell.
The path, where the PDF-file is saved is known and won't change, and the first 7 characters of the filename won't change, because it contains the ID-number.

I now want to go to the directory in the path and there loop through all files, get the filename as string, see if the first 7 characters match and if yes, open the file and Exit Sub.
The string-function part is OK, but everything else??? How to handle directorys and files in VBA???

I hope someone here can get me started.



ivan

QuoteHow to handle directorys and files in VBA???
you need to use FileSystemObject

QuoteDim fso As Scripting.FileSystemObject
Dim path_fam As String
Set fso = CreateObject("Scripting.FileSystemObject")
...
i guess you'll find the rest easily ;)