PDA

View Full Version : [SOLVED:] VBA to Update Excel Workbook Properties



Slicemahn
06-16-2022, 01:35 PM
Hi Everyone,

Currently my function is giving all sorts of errors when I try to update the properties (Status).


Function XclPropertiesUpdt (wb as string, upcond as string)

Dim wbk as Workbook

Select Case upcond

Case "Activate"
Workbooks.CheckOut (wb)
Set wbk = Workbooks.Open(wb)
wbk.ContentTypeProperites("Status").Value = "Active"
wbk.CheckIn Ture, "Changed report status"

Case "Decommission"
Workbook.CheckOut(wb)
Set wbk = Workbooks.Open(wb)
wbk.ContentTypeProperties("Status").Value= "Decommission"
wbk.CheckIn True, "Changed to report to be decommissioned"

End Select

End Function


I would appreciate any help that you can provide. Thanks.

georgiboy
06-16-2022, 11:41 PM
Without going into detail and testing the code, a couple of bits I notice from reading:

True not looking good

wbk.CheckIn Ture, "Changed report status"

Missing the s on the second CheckOut

Workbooks.CheckOut wb

snb
06-17-2022, 12:22 AM
Properites

I think it's more a spectacles issue.
See: https://www.specsavers.com/

Slicemahn
06-17-2022, 05:42 AM
What a spectacle, indeed (embarrassed). I have been looking at this far too long but not good enough. Thank you guys.