Toon posts:

PDF's zoeken en openen

Pagina: 1
Acties:
  • 100 views sinds 30-01-2008

Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
Hallo,

Op een access formulier heb ik een actiebutton gemaakt waarmee een pdf gezocht en geopend moet worden. De pdf's staan in subdirs onder de map F:\data\documentatie\tekeningen\. De naam van de pdf is gelijk aan het veld art_Art_ID. Ik krijg het voor elkaar om pdf's te openen die in de root van de map tekeningen staan, maar de pdf die in subdirs staan krijg ik niet geopend. Hieronder heb ik het scriptje geplaatst waar ik meer aan het rotzooien ben. Ik denk dat het probleem hem vooral zit in het gedeelte na "If .Execute > 0 Then" op die plek zou ik volgens mij op moeten geven dat hij de gevonden pdf moet openen. Ik ben niet zo thuis in vb dus ik zou niet weten met welke functie dat kan. Ik hoop dat iemand mij hierop een antwoord kan geven.

Alvast bedankt!

Private Sub pdf_Click()

Dim stAppName$, stPathName$
Start = Me!art_Art_ID
stAppName = "F:\apps\Adobe\AcroRd32.exe "
stPathName = "F:\data\documentatie\tekeningen\"
stFileName = Start & "*" & ".pdf"

Set fs = Application.FileSearch
With fs
.LookIn = stPathName
.FileName = stFileName
.SearchSubFolders = True
If .Execute > 0 Then

????????????????????

Exit Sub

Else
MsgBox "There were no files found."
End If
End With

End Sub

Acties:
  • 0 Henk 'm!

  • Schonhose
  • Registratie: April 2000
  • Laatst online: 17-09 20:01

Schonhose

Retro Icoon

Kun je niet gewoon het path terug vragen, inclusief de bijbehorende filename?
Als het goed is worden die opgeslagen in de array FoundFiles

Visual Basic:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
With Application.FileSearch
        .LookIn = stPathName
        .SearchSubFolders = True
        .filename = stFileName
       
    If .Execute() > 0 Then
        MsgBox "There were " & .FoundFiles.Count & _
            " file(s) found."
        strPDFPadFile = .FoundFiles(.FoundFiles.Count)           'return the path of the last one found
    Else
        MsgBox "There were no files found."
    End If

End With



Daarnaast hoop ik dat alles uniek is (dwz art_Art_ID) maar 1x voorkomt.

[ Voor 18% gewijzigd door Schonhose op 13-07-2006 13:27 ]

"The thing under my bed waiting to grab my ankle isn't real. I know that, and I also know that if I'm careful to keep my foot under the covers, it will never be able to grab my ankle." - Stephen King
Quinta: 3 januari 2005


Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
Hartstikke bedankt! Het is gelukt met het onderstaande script.


Dim stAppName$, stPathName$
Start = Me!art_Art_ID
stAppName = "F:\apps\Adobe\AcroRd32.exe "
stPathName = "F:\data\documentatie\tekeningen\"
stFileName = Start & "*" & ".pdf"

Set fs = Application.FileSearch
With fs
.LookIn = stPathName
.FileName = stFileName
.SearchSubFolders = True
If .Execute > 0 Then
MsgBox "Er zijn " & .FoundFiles.Count & _
"bestand(en) gevonden. "
strNotePadFile = .FoundFiles(.FoundFiles.Count)
Call Shell(stAppName & strNotePadFile, 1)
Else
MsgBox "Er is geen PDF gevonden."
End If
End With

Acties:
  • 0 Henk 'm!

Verwijderd

Beetje een oude topic maar nog heel relevant.

Kan ik ook op de inhoud zoeken met deze functie?

.TextorProperty

geven ze aan in de helpfile maar dat werkt niet bij een pdf file.

Iemand een idee?

Acties:
  • 0 Henk 'm!

  • Creepy
  • Registratie: Juni 2001
  • Laatst online: 20:53

Creepy

Tactical Espionage Splatterer

Open daarvoor even een nieuw topic AUB ;)

Let daarbij wel op Programming Beleid - De Quickstart want je geeft nu veel te weinig informatie. "het werkt niet" zegt mij in elk geval helemaal niks ;)

"I had a problem, I solved it with regular expressions. Now I have two problems". That's shows a lack of appreciation for regular expressions: "I know have _star_ problems" --Kevlin Henney


Dit topic is gesloten.