P
padmaja
Hi ,
I am facing a major problem for my task.In this task
what we do is, export the comments entered in a word
document to an excel sheet.
The problem is as follows:
Before exporting the Word Comments to an excel sheet,it
has to check for the builtindocument properties,so that
only excel sheets with the particular title property are
selected.
i tried checking for the builtindocument property
(this is a macro in word which should get the excel sheet
builtindocument property) using the following code:
Private Function IsValidxls(xlBook As Object, Optional
sTemplateID As String) As Boolean
Dim bValid As Boolean
Dim sTemplateID As String
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.ActiveWorkbook
Set xlSheet = ActiveSheet
On Error GoTo ErrorHandler
sTemplateID = xlbook.BuiltinDocumentProperties
("keywords").Value
'// Check whether the selected excel sheet is a valid
template
If sTemplateID = MPP_GIP_TEMPLATE_ID Then
bValid = True
Else
'// This required.
'// Template ID will be retured from the function
when it is not matching
bValid = False
End If
ExitRoutine:
IsValidxls = bValid
Exit Function
ErrorHandler:
bValid = False
Resume ExitRoutine
End Function
when i run my program using this function it give an error
message "Object Variable or With block variable not set"
could anyone help me out regarding this.
Thanks & Regards,
Padmaja
I am facing a major problem for my task.In this task
what we do is, export the comments entered in a word
document to an excel sheet.
The problem is as follows:
Before exporting the Word Comments to an excel sheet,it
has to check for the builtindocument properties,so that
only excel sheets with the particular title property are
selected.
i tried checking for the builtindocument property
(this is a macro in word which should get the excel sheet
builtindocument property) using the following code:
Private Function IsValidxls(xlBook As Object, Optional
sTemplateID As String) As Boolean
Dim bValid As Boolean
Dim sTemplateID As String
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.ActiveWorkbook
Set xlSheet = ActiveSheet
On Error GoTo ErrorHandler
sTemplateID = xlbook.BuiltinDocumentProperties
("keywords").Value
'// Check whether the selected excel sheet is a valid
template
If sTemplateID = MPP_GIP_TEMPLATE_ID Then
bValid = True
Else
'// This required.
'// Template ID will be retured from the function
when it is not matching
bValid = False
End If
ExitRoutine:
IsValidxls = bValid
Exit Function
ErrorHandler:
bValid = False
Resume ExitRoutine
End Function
when i run my program using this function it give an error
message "Object Variable or With block variable not set"
could anyone help me out regarding this.
Thanks & Regards,
Padmaja