Open excel file

  • Thread starter Thread starter Sangeetha
  • Start date Start date
S

Sangeetha

Hi,

I want to open excel file using a commnad button placed in a form. I have
read the other questions to this to use runapplication. But, what I am
looking for is as follows:

i have tax database which contain the taxpayer name, taxyear and the Taxid
number. I have placed this table in a form. The tax caluclations are made in
excel and stored in a particular folder say named, Tax_comp and with
filenames Taxpayer_year.xlsx. I want to place a command button on the form,
and when the user clicks the command button, i want the particular tax payer
excel tax computation file stored in the folder to open. Is this possible.

Also, I take this oppurtunity to apologize for not responding to those, who
have responded to my earlier query on creating autonumber based on
conditions. It worked. Many thanks. I had a problem in replying. Whenever i
tried, it came out of the browser and it gets hanged up in the hotmail.
 
Assuming all you want is to open the file, you can use FollowHyperlink

Dim strFile As String

strFile = "C:\Tax_comp\" & strTaxpayer & "_" & lngYear & ".xlsx"
If Len(Dir(strFile)) > 0 Then
Application.FollowHyperlink strFile
Else
MsgBox strFile & " does not exist."
End If
 
Thanks for your quick response.

But, i am afraid, it is not working. Please let me know what is the format
you have assumed for year.

I created two excel files (the 2007 version is a trial version which I am
using at present) named maran_2009 and sangeetha _2008 and saved it in the
folder C:\tax_comp.

The records are tax_payer_id (Autonumber) - 1, TaxPayer (Text)-
Sangeetha,tax_year(date)-30/06/2008. and the other record simliar 2, Maran,
30/06/2009.

It always executes the else command and says file foes not exists. please
help.
 
I'm assuming that strFile will contain the full path to the file to be
opened.

Sorry, I thought that was obvious...
 
Oh! Thanks. I got it.

Douglas J. Steele said:
I'm assuming that strFile will contain the full path to the file to be
opened.

Sorry, I thought that was obvious...

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)





.
 
Back
Top