Hi Everyone,
I'm developing a Excel Macro in 2003 format. This Macro will open a Word Document (Code Template_Modified_V3.doc - 2003 format) and update the fields in the word document and this work continues in a for loop. Inturn there is a Macro in the Word Document too. so each time I'm getting Security Warning Message in the Word Document whether to Disable or Enable the Macro. My company doesnt allow me to change the Security Level of the macro to Low. Neither it allows to sign the Macro with Digital Certificate.
So I tried to add 'objWord.DisplayAlerts = False'. But this doesn't work
Is there any other method to handle this Security warning programmatically??
Please help. Thanks in Advance.
Please note that I'm using MS Office 2003
Code :
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
objWord.DisplayAlerts = False 'To Disable the security warning messaage
ABC_Ouput_Path = "C:\New Folder\" 'Result Folder
'runnning loop for each row in the input sheet
For RowIndex = StartRow To EndRow 'Total rows in the input data sheet
ABC_Name = "Code_Template" '& RowIndex 'you can use diffrent file name for each row
ABC_Template_Path = "C:\Code Template_Modified_V3.doc"
Set Doc = objWord.Documents.Open(ABC_Template_Path)
sMedicalPlanCode = range.Cells(RowIndex, 1)
sCOC = range.Cells(RowIndex, 3)
sSegment = range.Cells(RowIndex, 4)
sState = range.Cells(RowIndex, 5)
sProduct = range.Cells(RowIndex, 8)
sStart_Date = range.Cells(RowIndex, 225)
sEnd_Date = range.Cells(RowIndex, 226)
sSegment = range.Cells(RowIndex, 4)
sCustomer_Service = range.Cells(RowIndex, 223)
sDeductible = range.Cells(RowIndex, 227)
sPlan = range.Cells(RowIndex, 224)
'Read all values from the input sheet for a specific row
objWord.Run "Driver", sEnd_Date, sStart_Date, sMedicalPlanCode, sState, sCOC, sSegment, sCustomer_Service, sDeductible, sProduct, sPlan
Doc.SaveAs ABC_Ouput_Path & ABC_Name & "_" & sMedicalPlanCode & ".doc"
Doc.Close
Next
Bookmarks