Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / December 2005

Tip: Looking for answers? Try searching our database.

open excel file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kevcar40 - 16 Dec 2005 07:16 GMT
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
Danny J. Lesandrini - 16 Dec 2005 13:58 GMT
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.
Signature


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

Tom van Stiphout - 16 Dec 2005 14:12 GMT
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
>
[quoted text clipped - 17 lines]
>
>kevin
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.