Opening an Excel or Word file from Command Button

  • Thread starter Elton, Ilona & Justin Wright
  • Start date

E

Elton, Ilona & Justin Wright

Hello,

I feel sure the answer to this has been posted before, but a quick search of
the headers doesn't seem to show an answer.

How can I open an existing Word or Excel file from a Command Button on
Access - and when I do, will my db remain open.

To return, I presume I would need to code my word or excel files somehow,
but as a newbie to Access, and only knowing as much as I have taught myself,
aren't sure how I go about this.

Any help greatly appreciated.

Elton
 
Ad

Advertisements

A

Arvin Meyer

If you use automation to open the file, you can manipulate it from within
Access, then close and return to Access. Or you can use the ShellExecute api
to actually open a file with Ecel or Word, then manually work from within
those programs. Here's some relevant links for sample code:

http://www.datastrat.com/Code/WordMerge.txt
http://www.mvps.org/access/modules/mdl0006.htm
http://www.mvps.org/access/api/api0018.htm
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
A

Albert D.Kallal

You can place a button on a form. The following code behind the button will
open a document:

application.FollowHyperlink "c:\data\Sales.xls"

The above would open a Excel document.

And, for word..

application.FollowHyperlink "c:\data\Sales.doc"
 
A

adsl

Elton said:
Hello,

I feel sure the answer to this has been posted before, but a quick search
of the headers doesn't seem to show an answer.

How can I open an existing Word or Excel file from a Command Button on
Access - and when I do, will my db remain open.

To return, I presume I would need to code my word or excel files somehow,
but as a newbie to Access, and only knowing as much as I have taught
myself, aren't sure how I go about this.

Any help greatly appreciated.

Elton
 
A

adsl

Arvin Meyer said:
If you use automation to open the file, you can manipulate it from within
Access, then close and return to Access. Or you can use the ShellExecute
api
to actually open a file with Ecel or Word, then manually work from within
those programs. Here's some relevant links for sample code:

http://www.datastrat.com/Code/WordMerge.txt
http://www.mvps.org/access/modules/mdl0006.htm
http://www.mvps.org/access/api/api0018.htm
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
A

adsl

Albert D.Kallal said:
You can place a button on a form. The following code behind the button
will open a document:

application.FollowHyperlink "c:\data\Sales.xls"

The above would open a Excel document.

And, for word..

application.FollowHyperlink "c:\data\Sales.doc"


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(e-mail address removed)
http://www.members.shaw.ca/AlbertKallal
 
Ad

Advertisements

A

adsl

Albert D.Kallal said:
You can place a button on a form. The following code behind the button
will open a document:

application.FollowHyperlink "c:\data\Sales.xls"

The above would open a Excel document.

And, for word..

application.FollowHyperlink "c:\data\Sales.doc"


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(e-mail address removed)
http://www.members.shaw.ca/AlbertKallal
 
A

adsl

Arvin Meyer said:
If you use automation to open the file, you can manipulate it from within
Access, then close and return to Access. Or you can use the ShellExecute
api
to actually open a file with Ecel or Word, then manually work from within
those programs. Here's some relevant links for sample code:

http://www.datastrat.com/Code/WordMerge.txt
http://www.mvps.org/access/modules/mdl0006.htm
http://www.mvps.org/access/api/api0018.htm
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Ad

Advertisements

A

adsl

Elton said:
Hello,

I feel sure the answer to this has been posted before, but a quick search
of the headers doesn't seem to show an answer.

How can I open an existing Word or Excel file from a Command Button on
Access - and when I do, will my db remain open.

To return, I presume I would need to code my word or excel files somehow,
but as a newbie to Access, and only knowing as much as I have taught
myself, aren't sure how I go about this.

Any help greatly appreciated.

Elton
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top