I am trying to get the following code to work:
<<
Sub CallSetPropertyFunction()
Dim PropertyName As String
Dim PropertySet As PropertyLocation
Dim PropertyValue As Variant
Dim ContentLink As Boolean
Dim TargetWorkBook As Workbook
PropertyName = "Medical"
PropertySet = PropertyLocationBoth
PropertyValue = "Hospital"
ContentLink = False
Workbooks.Open ("N:\!DocumentDayFile\1SetPropertyTest.xlsx")
Set TargetWorkBook = Workbooks("N:\!DocumentDayFile\1SetPropertyTest.xlsx")
<<
The line starting "Workbooks.Open..." works in that it opens the correct file thus proving that the file exists.
The line starting "Set TargetWorkBook..." results in the above run time error.
I am new to VBA programming but studies so far indicate that this error occurs when the target does not exist but the previous line opens the file successfully thus proving that it does.
The ultimate project objective is to create custom file properties to scanned pdf files and office documents and set their values. This is just the first step.
Any help would be appreciated.
Bookmarks