ThrottleWorks
Excel Ninja
Hi,
I am using below mentioned code to add “CustomDocumentProperties.Add Name”.
My code is skipping “objWordApp.ActiveDocument.CustomDocumentProperties.Add Name:="YourName", LinkToContent:=False, Value:="thename", _
Type:=msoPropertyTypeString” line.
As soon as code hits this line, macro exits this procedure and returns to parent procedure.
Till this line macro is working fine.
Word document is open.
I can see the word file name by using Control + G.
I am not able to understand why this is happening.
'InsertConfidentialityFooter' is called by another module.
'objWordApp' is defined as public variable in parent procedure.
Can anyone please help me in this.
I am using below mentioned code to add “CustomDocumentProperties.Add Name”.
My code is skipping “objWordApp.ActiveDocument.CustomDocumentProperties.Add Name:="YourName", LinkToContent:=False, Value:="thename", _
Type:=msoPropertyTypeString” line.
As soon as code hits this line, macro exits this procedure and returns to parent procedure.
Till this line macro is working fine.
Word document is open.
I can see the word file name by using Control + G.
I am not able to understand why this is happening.
'InsertConfidentialityFooter' is called by another module.
'objWordApp' is defined as public variable in parent procedure.
Can anyone please help me in this.
Code:
Sub InsertConfidentialityFooter()
'SOURCE: www.TheSpreadsheetGuru.com
Dim flag As Variant
Dim flag1 As Variant
Dim prop As Variant
Dim Author As Variant
Dim Sht As Worksheet
flag = False
flag1 = False
For Each prop In objWordApp.ActiveDocument.CustomDocumentProperties
If prop.Name = "DummyText1" Then
flag = True
End If
If prop.Name = "DummyText1" Then
flag1 = True
End If
Next prop
objWordApp.ActiveDocument.CustomDocumentProperties.Add Name:="YourName", LinkToContent:=False, Value:="thename", _
Type:=msoPropertyTypeString
With ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range
.Text = "CONFIDENTIAL - INTERNAL USE ONLY"
.ParagraphFormat.Alignment = wdAlignParagraphCenter
.Font.Size = 10 'size 10 font
End With
End Sub
Last edited: