Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Noe Noe is offline
external usenet poster
 
Posts: 20
Default Open Files with Macro or switch windows with macro

How can I open a file with macros if the date change every day, i try to do
the macro to open the files i need but it give me an error every time the
date change.
Its the same if i open the file and try to go back by window its give in me
an error
Windows(" REPORT 09262009.xls").Activate I just want to the macro reconize
every time its change the date. can some one help me with this problem i have
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default Open Files with Macro or switch windows with macro

How about

Dim todaysDate As String
todaysDate = Format(Now, "mmddyyyy")

Windows(" REPORT " & todaysDate & ".xls").Activate

That will always open the spreadsheet for today. "REPORT 09292009.xls"
today, "REPORT 09302009.xls" tomorrow, and so on.

Does that work for you?

--JP

On Sep 29, 2:41*pm, Noe wrote:
How can I open a file with macros if the date change every day, i try to do
the macro to open the files i need but it give me an error every time the
date change.
Its the same if i open the file and try to go back by window its give in me
an error
Windows(" REPORT 09262009.xls").Activate I just want to the macro reconize
every time its change the date. can some one help me with this problem i have


  #3   Report Post  
Posted to microsoft.public.excel.programming
Noe Noe is offline
external usenet poster
 
Posts: 20
Default Open Files with Macro or switch windows with macro

Jp this is great, I just have another question can i put with a number how
many dates the formula can go, like if i want the date of yestarday will be
-1
or one day before yestarday -2 something like that.

"JP" wrote:

How about

Dim todaysDate As String
todaysDate = Format(Now, "mmddyyyy")

Windows(" REPORT " & todaysDate & ".xls").Activate

That will always open the spreadsheet for today. "REPORT 09292009.xls"
today, "REPORT 09302009.xls" tomorrow, and so on.

Does that work for you?

--JP

On Sep 29, 2:41 pm, Noe wrote:
How can I open a file with macros if the date change every day, i try to do
the macro to open the files i need but it give me an error every time the
date change.
Its the same if i open the file and try to go back by window its give in me
an error
Windows(" REPORT 09262009.xls").Activate I just want to the macro reconize
every time its change the date. can some one help me with this problem i have



  #4   Report Post  
Posted to microsoft.public.excel.programming
Noe Noe is offline
external usenet poster
 
Posts: 20
Default Open Files with Macro or switch windows with macro

Windows(" REPORT 09262009.xls").Activate The formula you sent me was only
read from todays date and if i need to open that file 09262009 its give in me
an error.

"Noe" wrote:

Jp this is great, I just have another question can i put with a number how
many dates the formula can go, like if i want the date of yestarday will be
-1
or one day before yestarday -2 something like that.

"JP" wrote:

How about

Dim todaysDate As String
todaysDate = Format(Now, "mmddyyyy")

Windows(" REPORT " & todaysDate & ".xls").Activate

That will always open the spreadsheet for today. "REPORT 09292009.xls"
today, "REPORT 09302009.xls" tomorrow, and so on.

Does that work for you?

--JP

On Sep 29, 2:41 pm, Noe wrote:
How can I open a file with macros if the date change every day, i try to do
the macro to open the files i need but it give me an error every time the
date change.
Its the same if i open the file and try to go back by window its give in me
an error
Windows(" REPORT 09262009.xls").Activate I just want to the macro reconize
every time its change the date. can some one help me with this problem i have



  #5   Report Post  
Posted to microsoft.public.excel.programming
Noe Noe is offline
external usenet poster
 
Posts: 20
Default Open Files with Macro or switch windows with macro

JP
I did this but its not working but i belive its correct.
Dim yestardate As String
todaysdate = Format((Now) - 3, "mmddyyyy")

Windows(" REPORT " & todaysdate & " .xls").Activate

Noe" wrote:

Windows(" REPORT 09262009.xls").Activate The formula you sent me was only
read from todays date and if i need to open that file 09262009 its give in me
an error.

"Noe" wrote:

Jp this is great, I just have another question can i put with a number how
many dates the formula can go, like if i want the date of yestarday will be
-1
or one day before yestarday -2 something like that.

"JP" wrote:

How about

Dim todaysDate As String
todaysDate = Format(Now, "mmddyyyy")

Windows(" REPORT " & todaysDate & ".xls").Activate

That will always open the spreadsheet for today. "REPORT 09292009.xls"
today, "REPORT 09302009.xls" tomorrow, and so on.

Does that work for you?

--JP

On Sep 29, 2:41 pm, Noe wrote:
How can I open a file with macros if the date change every day, i try to do
the macro to open the files i need but it give me an error every time the
date change.
Its the same if i open the file and try to go back by window its give in me
an error
Windows(" REPORT 09262009.xls").Activate I just want to the macro reconize
every time its change the date. can some one help me with this problem i have




  #6   Report Post  
Posted to microsoft.public.excel.programming
Noe Noe is offline
external usenet poster
 
Posts: 20
Default Open Files with Macro or switch windows with macro

JP

Thank you so much for your help this is done, Thank you and have a great day.

"Noe" wrote:

Windows(" REPORT 09262009.xls").Activate The formula you sent me was only
read from todays date and if i need to open that file 09262009 its give in me
an error.

"Noe" wrote:

Jp this is great, I just have another question can i put with a number how
many dates the formula can go, like if i want the date of yestarday will be
-1
or one day before yestarday -2 something like that.

"JP" wrote:

How about

Dim todaysDate As String
todaysDate = Format(Now, "mmddyyyy")

Windows(" REPORT " & todaysDate & ".xls").Activate

That will always open the spreadsheet for today. "REPORT 09292009.xls"
today, "REPORT 09302009.xls" tomorrow, and so on.

Does that work for you?

--JP

On Sep 29, 2:41 pm, Noe wrote:
How can I open a file with macros if the date change every day, i try to do
the macro to open the files i need but it give me an error every time the
date change.
Its the same if i open the file and try to go back by window its give in me
an error
Windows(" REPORT 09262009.xls").Activate I just want to the macro reconize
every time its change the date. can some one help me with this problem i have


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default Open Files with Macro or switch windows with macro

Looks like you figured it out, congrats and good luck!

--JP

On Sep 29, 4:08*pm, Noe wrote:
JP

Thank you so much for your help this is done, Thank you and have a great day.



"Noe" wrote:
Windows(" REPORT 09262009.xls").Activate *The formula you sent me was only
read from todays date and if i need to open that file 09262009 its give in me
an error.


"Noe" wrote:


Jp this is great, I just have another question can i put with a number how
many dates the formula can go, like if i want the date of yestarday will be
-1
or one day before yestarday -2 something like that.


"JP" wrote:


How about


Dim todaysDate As String
todaysDate = Format(Now, "mmddyyyy")


Windows(" REPORT " & todaysDate & ".xls").Activate


That will always open the spreadsheet for today. "REPORT 09292009.xls"
today, "REPORT 09302009.xls" tomorrow, and so on.


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
Macro switch between windows question punter Excel Discussion (Misc queries) 3 June 21st 06 06:11 PM
Need a sample or VBA code to open a C# windows forms in Excel using Macro dotnetguys Excel Programming 0 February 3rd 06 02:05 PM
Macro to open *.dat files and save as .txt (comma delimited text files) [email protected] Excel Programming 2 November 30th 05 05:50 AM
Want to Open Windows Explorer With an Excel Macro johan Excel Programming 2 September 20th 05 09:55 AM
Open File or Switch Between Windows if File is Open Ricky Pang Excel Programming 0 July 2nd 05 08:41 PM


All times are GMT +1. The time now is 07:05 PM.

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

About Us

"It's about Microsoft Excel"