473,320 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Closing a PDF file from VBA

I've written some code which opens a PDF file using :

"Application.FollowHyperlink strdbFilePath & strFileName, , True"

The user then types some information into the form and then clicks a
button which generates a new filepath for the file. Unfortunatly, if
the user doesn't close the PDF file, the whole thing grinds to a halt.
Just wondering if there is some code that I could put in the button to
close the pdf file when clicked??

Cheers

Reg

Aug 8 '06 #1
3 14537
Regnab wrote:
I've written some code which opens a PDF file using :

"Application.FollowHyperlink strdbFilePath & strFileName, , True"

The user then types some information into the form and then clicks a
button which generates a new filepath for the file. Unfortunatly, if
the user doesn't close the PDF file, the whole thing grinds to a halt.
Just wondering if there is some code that I could put in the button to
close the pdf file when clicked??

Cheers

Reg
Check out
http://www.mvps.org/access/api/api0007.htm
http://www.mvps.org/access/api/api0013.htm
http://www.mvps.org/access/api/api0025.htm

One of these should help.

With 13, and some mods on your part, you can get both class and caption.

I like http://www.mvps.org/access/api/api0018.htm to open up files
instead of FollowHyperLink. I can control the window state and I can
have the user dblclick instead of single click like a hyperlink part (I
separate the display text from the address and use the dblclick event).
Aug 8 '06 #2
Thanks Salad,

Works a treat. Might be pushing my luck a little now, but is it
possible to close the file rather than the application. What you've
pointed me to works great and will do what I need.... but in the ever
growing desire to make one's databases a little more effecient, is it
possible to close just the file (as I think this would make subsequent
pdf file opening quicker if adobe is already running).

The other thing you mentioned that I was curious about is it allows you
to control the window state. What does that mean?

Thanks for all your help

Cheers

Reg

Aug 8 '06 #3
Regnab wrote:
Thanks Salad,

Works a treat. Might be pushing my luck a little now, but is it
possible to close the file rather than the application. What you've
pointed me to works great and will do what I need.... but in the ever
growing desire to make one's databases a little more effecient, is it
possible to close just the file (as I think this would make subsequent
pdf file opening quicker if adobe is already running).
You might want to google around...see
http://groups.google.com/advanced_search
and enter
*Access*
in the groups texbox and something like
Adobe automation
in the search for.

If Adobe allows automation, you'll probably find some code to do a
file/close or file/save

The other thing you mentioned that I was curious about is it allows you
to control the window state. What does that mean?
Min, Max, etc.
>
Thanks for all your help

Cheers

Reg
Aug 9 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: simon place | last post by:
Spent some very frustrating hours recoding to find a way of closing a server socket, i'd not thought it would be any problem, however, after complete failure and as a last resort, i looked at the...
2
by: Atulvid | last post by:
Hi, I created a test file for my application by writing structures to a binary file. To make sure that I will get correct data for the pointers inside the structure, i wrote actual data they...
1
by: MuZZy | last post by:
HI, I have a user control, say with one textBox. I need the following: when the user closes form (either calling Form.Close, or pressing "X" or anyhow), UserControl copies a file from a...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
3
by: Carroll, Barry | last post by:
Greetings: Please forgive me if this is the wrong place for this post. I couldn't find a more acceptable forum. If there is one, please point me in the right direction. I am part of a small...
6
by: Steven D'Aprano | last post by:
Closing a file can (I believe) raise an exception. Is that documented anywhere? I've spent a lot of frustrating time trying to track this down, with no luck, which suggests that either my...
1
by: Paul Rubin | last post by:
it looks like contextlib.closing fails to be idempotent, i.e. wrapping closing() around another closing() doesn't work. This is annoying because the idea of closing() is to let you use legacy...
5
by: buu | last post by:
I have an app made in vb.net with a part of it made in vc.net. after finishing a data processing with a file, I would like to delete that file, but file remains locked to be sure, I was: -...
11
by: Simon van Beek | last post by:
Dear reader, By opening an application I get always the main Access window with the closing cross in the above right corner. Is there a possibility to make this closing cross invisible? ...
4
Fr33dan
by: Fr33dan | last post by:
Hi, I'm having trouble with a multi-threaded program crashing on a specific machine when the worker thread is not initialized at when the _FormClosing method of my main form called. Here is my...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.