Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Default Help with MACRO for opening workbook

Hi I want to open a workbook from a macro that has a date included in the name. I'd like it to open the newest one in the folder a new one is added every day.
Ive got this so far but what do change to make it open the latest date.

ChDir "P:\Conduit"
Workbooks.Open Filename:="P:\Conduit\Shift Checker - 29th November.xls", _
Notify:=False
Application.WindowState = xlMaximized
Range("F2:H4").Select
ActiveCell.FormulaR1C1 = "31770"
Range("F5").Select
Application.Run "'Shift Checker - 29th November.xls'!all"
End Sub

Thanks Stu
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Help with MACRO for opening workbook

On Friday, November 30, 2012 10:28:52 PM UTC+11, sTUROB wrote:
Hi I want to open a workbook from a macro that has a date included in

the name. I'd like it to open the newest one in the folder a new one is

added every day.

Ive got this so far but what do change to make it open the latest date.



ChDir "P:\Conduit"

Workbooks.Open Filename:="P:\Conduit\Shift Checker - 29th

November.xls", _

Notify:=False

Application.WindowState = xlMaximized

Range("F2:H4").Select

ActiveCell.FormulaR1C1 = "31770"

Range("F5").Select

Application.Run "'Shift Checker - 29th November.xls'!all"

End Sub



Thanks Stu









--

sTUROB


This would open the file (provided the date was "today".

Sub tester()
Workbooks.Open Filename:="Shift Checker - " & Format(Date, "d") & "nd " & Format(Date, "mmmm") & ".xls"
End Sub
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
Opening a new workbook via a macro Chris Maddogz Excel Programming 2 May 23rd 09 08:09 AM
Opening a Workbook with a Macro Eli[_4_] Excel Discussion (Misc queries) 4 October 3rd 08 12:13 AM
Enable macro on opening workbook ASU Excel Discussion (Misc queries) 5 July 3rd 06 05:40 PM
Macro Opening or Looking for Another Workbook Toolman045 Excel Programming 6 June 13th 06 03:04 AM
Run macro when opening workbook nsv Excel Discussion (Misc queries) 4 September 6th 05 12:19 PM


All times are GMT +1. The time now is 11:59 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"