View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Les Stout[_2_] Les Stout[_2_] is offline
external usenet poster
 
Posts: 396
Default Select last months file

Thanks very much Bob and Stefi, i have tried to replace the <file with
a variable and it does not like it, could you help please ?

Const sFile As String = "gAMS_Report_" & Month &".xls"
Dim sFilename As String
Dim sThis As Workbook
Dim sLast As Workbook

sFilename = Replace(sFile, Month, Format(Date, "mmm-yy"))
Set oWBThis = Workbooks.Open(sFile)
sFilename = Replace(sFile, Month, Format(Date - Day(Date),
"mmm-yy"))
Set oWBLast = Workbooks.Open(sFile)


Les Stout

*** Sent via Developersdex http://www.developersdex.com ***