Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Need to write a program to open a filename...

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Need to write a program to open a filename...

workbooks.open filename:= "S:\Accounting\Monthly Report\" & Range("A1").Text
& ".xls"

--

HTH

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


"Flop" wrote in message
...
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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Need to write a program to open a filename...

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!


"Flop" wrote:

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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Need to write a program to open a filename...

Nevermind, figured it out. Thanks for your help.

"Flop" wrote:

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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Workbooks.Open Filename Konczér Tamás Excel Worksheet Functions 2 July 4th 07 04:21 PM
set filename to <filename-date on open bob engler Excel Worksheet Functions 2 July 13th 06 05:11 AM
I cant open files unless I open the Excel program first ElaineAng Excel Discussion (Misc queries) 3 February 16th 06 02:54 PM
Program workbook title as the filename William[_2_] Excel Programming 0 June 3rd 04 03:03 AM
Open Filename + SendKeys Matthew[_6_] Excel Programming 5 July 31st 03 04:12 PM


All times are GMT +1. The time now is 05:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"