Problem setting CustomDocumentProperty in Excel wrkBk from Access

R

rhc

Access and Excel 2003 on XP

original line of code in excel that works:
ThisWorkbook.CustomDocumentProperties.Add _
Name:="JournalType", Type:=msoPropertyTypeString, _
Value:=strJEType, LinkToContent:=False

Code when I try to do the same thing from access that doesnt work. ie I get
error Number 5 Invalid procedure call or argument.

Dim xlAPP As Object
Dim xlWB As Object
Dim xlWS As Excel.Worksheet
Dim RActive As Excel.Range

Set xlAPP = CreateObject("Excel.Application")
xlAPP.EnableEvents = False
Set xlWB = xlAPP.Workbooks.Open("c:\er\test\test.xls")
Set xlWS = xlWB.Worksheets(1)

xlWB.CustomDocumentProperties.Add Name:="JournalType",
Type:=msoPropertyTypeString, Value:="4", LinkToContent:=False


Help!

thanks in advance
Bob
 
Top