By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,608 Members | 1,925 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,608 IT Pros & Developers. It's quick & easy.

open excel file

P: n/a
Hi i am trying to open an excel file from access using a button

the problem is the path and could change so i need to build the path to
the file
i am using textboxes to hold the information as it builds
ie first part of the path C:\Temp
second part of the path kevin carter
third part of the path Folder name
and then the file name

i am then concanting this information into a text box which gives me
the full path
ie C:\Temp\kevin carter\Folder name\ *********.xls

How can i use the text box to open the file?

or is there an easier way ?
thanks

kevin

Dec 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Kevin:

First, to answer your question, I suggest you use this code:

Dim sPath As String
sPath = Nz(Me.txtPathToFile, "")
If Dir(sPath) <> "" Then Application.FollowHyperlink sPath
Now, a bit of housekeeping ...

I noticed that you posted your question back as a response to your question.
This phenomenon happens way more often than I can explain, and maybe it
has something to do with some quality of the newsreader you use or some other
factor completely out of your control, but I finally feel compelled to offer
an unsolicited word of advice:
Try not to post back to your own question.

It's really self defeating. I can't speak for everryone who reads newsgroups,
but I know that I pay special attention to posts with no replies. That means
they are either new or no one has come up with a response and are in special
need of attention. By posting a reply to your own question, you flag yours as
"answered" already, when in fact it isn't. That can't help your cause.

I use the pronoun "you" here but it's not just you, of course, who does this.
Maybe I just don't understand what's happening here, but it strikes me that
people are going out of their way to post, double post, up post, down post
side post, reverse post ... post post post post post. A single post is usually all
that's required to get our attention.
--

Danny J. Lesandrini
dl*********@hotmail.com
http://amazecreations.com/datafast/


Dec 16 '05 #2

P: n/a
On 15 Dec 2005 23:16:21 -0800, "kevcar40" <ke******@btinternet.com>
wrote:

It might be easier to offer the user a File/Open dialog. Study this
much-quoted page: http://www.mvps.org/access/api/api0001.htm

What do you want to do with the Excel file after you open it?
If nothing else, you could use the Shell command, or a bit more fancy,
the ShellExecute API.

-Tom.

Hi i am trying to open an excel file from access using a button

the problem is the path and could change so i need to build the path to
the file
i am using textboxes to hold the information as it builds
ie first part of the path C:\Temp
second part of the path kevin carter
third part of the path Folder name
and then the file name

i am then concanting this information into a text box which gives me
the full path
ie C:\Temp\kevin carter\Folder name\ *********.xls

How can i use the text box to open the file?

or is there an easier way ?
thanks

kevin


Dec 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.