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
Diagram 1
- 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
Diagram 1