Muốn đọc thời gian lưu của một file bằng VBA

Liên hệ QC

phamvandunghp84

Thành viên thường trực
Tham gia
5/3/20
Bài viết
241
Được thích
12
em tìm được code này để xem thời gian lưu file lần cuối của chính file đó, vậy giờ muốn xem thời gian lưu file cuối cùng của một file khác ( không mở file này) thì làm thế nào ạ?
Sub xemthoigiantaofile()

Sheets("sheet3").Range("A2").Value = Format(ThisWorkbook.BuiltinDocumentProperties("Creation Date"), "short date")
Sheets("sheet3").Range("B2").Value = Format(ThisWorkbook.BuiltinDocumentProperties("Last Save Time"), "short date")

End Sub
 
Dùng FileSystemObject, đọc cái thuộc tính DateLastModified của file ấy.
 
Bạn ơi cho mình hỏi mình muốn làm như này cần phải sửa lại như nào mới đúng trong trường hợp chuỗi srs1, srs2 có chứa giá trị #NA ? Mình muốn bỏ qua giá trị #NA để lấy giá trị nhỏ nhất làm tỉ lệ biểu đồ nhưng code này nó luôn =0.

Sub doitoadoMin()
Dim i As Integer
Dim srs1 As Series
Dim srs2 As Series

On Error Resume Next
For i = 1 To ActiveSheet.ChartObjects.Count
With ActiveSheet.ChartObjects(i)
ActiveSheet.ChartObjects(i).Activate
Set srs1 = ActiveChart.SeriesCollection(1)
Set srs2 = ActiveChart.SeriesCollection(2)

Sheets("Sheet3").ChartObjects(i).Chart.Axes(xlValue).MinimumScale = Application.WorksheetFunction.Subtotal(105, srs1.Values)
Sheets("Sheet3").ChartObjects(i).Chart.Axes(xlValue, xlSecondary).MinimumScale = Application.WorksheetFunction.Subtotal(105, srs2.Values)
End With

Set srs1 = Nothing
Set srs2 = Nothing
Next i
On Error Resume Next
End Sub
 
Bạn ơi cho mình hỏi mình muốn làm như này cần phải sửa lại như nào mới đúng trong trường hợp chuỗi srs1, srs2 có chứa giá trị #NA ? Mình muốn bỏ qua giá trị #NA để lấy giá trị nhỏ nhất làm tỉ lệ biểu đồ nhưng code này nó luôn =0.

Sub doitoadoMin()
Dim i As Integer
Dim srs1 As Series
Dim srs2 As Series

On Error Resume Next
For i = 1 To ActiveSheet.ChartObjects.Count
With ActiveSheet.ChartObjects(i)
ActiveSheet.ChartObjects(i).Activate
Set srs1 = ActiveChart.SeriesCollection(1)
Set srs2 = ActiveChart.SeriesCollection(2)

Sheets("Sheet3").ChartObjects(i).Chart.Axes(xlValue).MinimumScale = Application.WorksheetFunction.Subtotal(105, srs1.Values)
Sheets("Sheet3").ChartObjects(i).Chart.Axes(xlValue, xlSecondary).MinimumScale = Application.WorksheetFunction.Subtotal(105, srs2.Values)
End With

Set srs1 = Nothing
Set srs2 = Nothing
Next i
On Error Resume Next
End Sub
Chủ đề khác rồi
 
Web KT
Back
Top Bottom