Need to write a program to open a filename...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to write a VBA program that will automatically reference a date in a
certain cell and then use the data in the cell to be able to locate a file
and open it.

Example:
Cell (1,2) has the data of: 12/31/04

Based on this info, the filename I wish to open is called 12-04.xls and is
located in the following location:

S:Accounting\Monthly Report\

How do I get VBA to automatically open the 12-04.xls file based on the data
in that cell? Remember that a future time the data in that cell will change
to a different date such as 02/28/05. In which case I would wish the program
to open 02-05.xls located in the same folder location.
 
workbooks.open filename:= "S:\Accounting\Monthly Report\" & Range("A1").Text
& ".xls"

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Hi Bob:

Thanks for the response. The VBA compiler seems to be having a problem wit
the last part of the code at: & ."xls"

Any idea why?

Thanks!
 

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

Back
Top