Hello,
In the VB editor click Tools, References and look for the Microsoft Scripting Runtime and select it.
Code like this will provide you with a files properties:-
Sub FileProperties()
Dim FSObj As New Scripting.FileSystemObject
Dim scrFile As Scripting.File
Set scrFile = FSObj.GetFile("C:\Excel files from T5H8I0\Budget.xls")
'You can now get the properties of the file e.g.
MsgBox "Date created = " & scrFile.DateCreated
MsgBox "Date last modified = " & scrFile.DateLastModified
MsgBox "Size = " & scrFile.Size & " bytes"
MsgBox "File type = " & scrFile.Type
End Sub
HTH,
Dax.
Thanks,
That worked perfectly, will this also be able to access the custom properties, I am not sure how to do that and I am most interested in getting data from there.
Here are two simple macros to do what you want. If you want the same macro to add/subtract depending on what the user chooses, you'll have to add some coding or (preferably) create a userform.
Sub AddtoCell()
oNumb = ActiveCell.Value
uNumb = InputBox("Enter Number to Add", "Add Number")
nNumb = oNumb + uNumb
ActiveCell.Value = nNumb
End Sub
Sub SubtractfromCell()
oNumb = ActiveCell.Value
uNumb = InputBox("Enter Number to Subtract", "Subtract Number")
nNumb = oNumb - uNumb
ActiveCell.Value = nNumb
End Sub
Assign these macros to hotkeys or to toolbar buttons for quick access.
-Ben