I have created a form with a hyperlink which opens a PDF file.
However when you click the link the file opens briefly and shuts down automatically, I have tried opening diffetrent file type and they work fine it is just the PDF that messes up.
For clarification if I open the PDF from explorer it works fine and I have tried several files.
Any suggestions.
Neil
5 2247
You have inadvertently posted your question in the Articles section rather than in the Forum section of our site, so I have moved it across to the Forum for you.
Welcome to TheScripts!
Linq ;0)>
I have created a form with a hyperlink which opens a PDF file.
However when you click the link the file opens briefly and shuts down automatically, I have tried opening diffetrent file type and they work fine it is just the PDF that messes up.
For clarification if I open the PDF from explorer it works fine and I have tried several files.
Any suggestions.
Neil
Neil,
Try using the ShellExecute method. It does not have the limitations that the Shell() function and Application.FollowHyperLink method do.
The following example uses ShellExecute on a button click event: -
Dim strPdfWriterPath As String
-
Dim strFilePath As String
-
-
'Open File
-
'strPdfWriterPath is the path to the application object
-
'strFilePath is the path to the file you want to open
-
-
strPdfWriterPath = "C:\Program Files\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe"
-
strFilePath = Me.FilePath
-
-
Call Shell(strPdfWriterPath & " " & strFilePath, vbMaximizedFocus)
many thanks puppydog, it worked
Neil,
Just to add, the problem you were seeing originaly is due to an issue with Acrobat reader. If you check you will probably find that it is version 7.0.0.
If you get the latest version it will cure the problem.
Garry
Neil,
Just to add, the problem you were seeing originaly is due to an issue with Acrobat reader. If you check you will probably find that it is version 7.0.0.
If you get the latest version it will cure the problem.
Garry
Just to add to this further, I had the same issue; this only occurred on machines that had both Adobe Acrobat and Adobe Reader installed, fairly common in our setup. I had to explicitly open the doc in reader. here's a section of the code I used in case it's of use to others, I know it took me days to find the answer on the web! - fCloseApp ("AdobeAcrobat")
-
Set fs = CreateObject("Scripting.FileSystemObject")
-
MyCaseID = Me.CaseID
-
-
'prints case documents where checkboxes are ticked
-
If Me.PrintDocs = -1 Then
-
Set MyControl = Forms!frmPatients.Form!sfrmCases.Form!sfrmDocuments
-
MyControl.SetFocus
-
Set ObjRecordSet = MyControl.Form.RecordsetClone
-
ObjRecordSet.MoveFirst
-
Do Until ObjRecordSet.EOF
-
If ObjRecordSet.Print = -1 Then
-
MySourceDir = DocPathWay
-
MyFileName = ObjRecordSet.FileName
-
StrOutputFile = MySourceDir & MyFileName
-
strAcroPath = "C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe"
-
If fs.FileExists(StrOutputFile) = True Then
-
strAcroPath = strAcroPath & " /t " & StrOutputFile
-
dwReturn = Shell(strAcroPath, vbMinimizedNoFocus)
-
DoCmd.SetWarnings False
-
MySQL = "INSERT INTO tblPrintHistory (EventType, UserID, CaseID, Document, PrintDate) " & _
-
"SELECT 1 as EventType, """ & fosEmpID & """ as UserID, """ & MyCaseID & """ as CaseID, " & _
-
"""" & stDocName & """ as document, Now() as PrintDate;"
-
DoCmd.RunSQL MySQL
-
DoCmd.SetWarnings True
-
-
Else
-
MsgBox StrOutputFile & " does not exist"
-
End If
-
End If
-
ObjRecordSet.MoveNext
-
Loop
-
End If
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Alfons |
last post by:
Hello,
I have build a program that can do file transferring between a Windows
XP computer and a DOS computer via a serial port. The Windows program
I have build in C++ with Visual Studio 6.0....
|
by: John Morgan |
last post by:
I am using the following link to download a file of about 50k
<a target= "_blank"
href="http://www.bsecs.org.uk/ExecDocs/documentStore/elfridaWord.doc">open
file</a>
If I save the file to...
|
by: Don Munroe |
last post by:
This one has me stumped. I have three web applications running on two
different servers. The first that works fine is hosted by a .Net hosting
company. Everyone that uses it has no problems...
|
by: John |
last post by:
Hi,
I posted this earlier in microsoft.public.dotnet.framework.aspnet, but
didn't get a response, so I thought I'd try here.
Basically, I'm having a problem opening / downloading csv files...
|
by: lennyw |
last post by:
Hi
I'm trying to build XMLgawk (latest version 3.1.5 from sourceforge) and
I'm getting some make errors. I'm using the tool availbale from Cygwin
to do the build (gcc, bash, make).
I was able...
|
by: emailus |
last post by:
I am webmaster for the domain <www.alpha1.org.au>.
Not being an expert in html, I take advantage of my domain
Registrant's web building tool, 'Instant Website'. This tool is
provided as part of...
|
by: compman9902 |
last post by:
Hello, and thank toy for reading this post.
Thus far, this website has helped me a lot,
(I have finally finished my encryptor: "site removed by moderator", go to the downloads link) and I will...
|
by: praveenkhade |
last post by:
I am working on asp.net ,C#. The pdf files in the grid are displaying properly.
The main prob is that in these pdfs one pdf is the main like an index ,if i open this pdf i can link to rest of...
|
by: navanova |
last post by:
Greetings,
I have a problem of opening ms word and excel files on my computer. The files are there for a long time. I use to open and modify them. Suddenly, when i try to open the word files, a...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |