lundi 28 mars 2016

Object doesnt support this property or method: Trying to use datelastmodified

I am trying to figure out how to use datelastmodified to check if a file that has the path and name (FilePath and FileName) is not equal to the current date. I keep getting multiple errors when trying to change the code so I could really use some help. Thank you in advance for any help!

Public Sub SaveandEmail() 'Saves dated files from BO Drop Box and sends email with attachment

Set WbDest = ThisWorkbook

Application.ScreenUpdating = False

Dim dateOf As Date
dateOf = CDate(Worksheets("Email").Range("Date"))

Dim FilePath As Range
Set FilePath = Range("FilePath")

Dim FileName As Range
Set FileName = Range("FileName")

Dim FilePathSave As Range
Set FilePathSave = Range("FilePathSave")

Dim FileNameSave As Range
Set FileNameSave = Range("FileNameSave")

Dim FilePathSaveDist As Range
Set FilePathSaveDist = Range("FilePathSaveDist")

Dim FileNameSaveDist As Range
Set FileNameSaveDist = Range("FileNameSaveDist")

If Format(FilePath & FileName.DateLastModified, "mm/dd/yyyy") <> Format(Date, "mm/dd/yyyy") Then
MsgBox ("Check to make sure that BO report ran for current day!")
End If

......Code

Aucun commentaire:

Enregistrer un commentaire