Chào cả nhà ! mình mới tập tò vba mình dùng code bên dưới để saveas 1 workbooks nhưng do file của mình có link với nhiều file khác nữa nên khi thực hiện lệnh chạy rất chậm mặc dù dung lượng không lớn , nếu muốn nhanh hơn thì mình phải copy value , nhưng nếu copy value thì mất hết công thức.
mình tháy thao tác này nếu làm bằng tay thì vẫn nhanh hơn code của mình. A.E có cách nào khắc phục không
xin chân thành cảm ơn .
Private Sub CommandButton1_Click()
Dim Wb As Workbook
Application.DisplayAlerts = False
If Dir(ThisWorkbook.Path & "\File Cost received from Section\Dir Material.xlsx", vbDirectory) = vbNullString Then
MsgBox "File khong ton tai"
Exit Sub
Else
Set Wb = Workbooks.Open(ThisWorkbook.Path & "\File Cost received from Section\Dir Material.xlsx")
Wb.SaveAs Filename:=ThisWorkbook.Path & "\Link Thao file vat tu dong so.xlsx", FileFormat:=51
Set Wb = Nothing
Wb.Close True
Application.DisplayAlerts = True
MsgBox "Update Succeed"
End If
End Sub
mình tháy thao tác này nếu làm bằng tay thì vẫn nhanh hơn code của mình. A.E có cách nào khắc phục không
xin chân thành cảm ơn .
Private Sub CommandButton1_Click()
Dim Wb As Workbook
Application.DisplayAlerts = False
If Dir(ThisWorkbook.Path & "\File Cost received from Section\Dir Material.xlsx", vbDirectory) = vbNullString Then
MsgBox "File khong ton tai"
Exit Sub
Else
Set Wb = Workbooks.Open(ThisWorkbook.Path & "\File Cost received from Section\Dir Material.xlsx")
Wb.SaveAs Filename:=ThisWorkbook.Path & "\Link Thao file vat tu dong so.xlsx", FileFormat:=51
Set Wb = Nothing
Wb.Close True
Application.DisplayAlerts = True
MsgBox "Update Succeed"
End If
End Sub