VBA Excel / Word - Want to Fix "Run Coding and received Security Notice"

justuptou

New Member
Joined
Jan 8, 2020
Messages
23
Office Version
  1. 2010
Platform
  1. Windows
I have developed a Excel VBA, when I run the coding, it will be :-

- Step 1) copy the data to the array
- Step 2) open winword template
- Step 3) copy the data to winword table (not a spreadsheet table)
- Step 4) Save as a report as winword file.

I used the excel VBA file over 5 years and there is no any error,
Suddenly, when I open the step 2), the winword error msg (Diagram 1) shown below if I have opened any winword.
and it will be suspended to run the coding and open the VB Editor......... I have to fix by manual and it is not for end user.

Can I "Enable Marcos" by coding if I have already opened winword and ignore below msg automatic ?

My
old coding (Statement #3~#6) is worked before aims for same situation but not now.

1) On Error Resume Next
2) Set objWord = CreateObject("Word.Application")
3) If Err.Number = 429 Then
4) Err.Clear
5) Set objWord = GetObject("Word.Application")
6) End If
7) objWord.Visible = True
8) objWord.Activate

1677228813926.png

Diagram 1
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
I don't have any solution to offer but just wondered are there any macros's in the document? What version of office are you using. What version of Windows are you using? Have you had any recent office or Windows updates? Seems like there's been several posts similar to this lately whereby code that previously worked has mysteriously stopped working. Dave
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top