Exporting to Word fillable form - VB is dead

ChrisCione

Board Regular
Joined
Aug 27, 2008
Messages
92
Office Version
  1. 365
Platform
  1. Windows
My MDB contains the following code to allow me to export data into a Word fillable form. I've used it for years. Just a few days ago, it quit working. What I mean is that when I click the command button this code is attached to, nothing happens. At all. No error, just nothing.

I use this at work. The only changes I'm aware of is continuous weekly "pushes" of any software updates by our IT department. The version of office I have on my machine is Professional Plus 2010. The IT folks tell me that last major update was sometime ago. But something's obviously changed that killed this code. I didn't change the Word doc at all, or the path. Any ideas?

<code>
'Download to SF39 Word Template.
Dim appWord As Word.Application
Dim doc As Word.Document
'Avoid error 429, when Word isn’t open.


On Error Resume Next
Err.Clear
'Set appWord object variable to running instance of Word.
Set appWord = GetObject(, "Word.Application")
If Err.Number <> 0 Then
'If Word isn’t open, create a new instance of Word.
Set appWord = New Word.Application
End If
Set doc = appWord.Documents.Open("O:\CIONE\~Recruitments\Recruitment Database\Forms\SF39_WORD.docm", , True)
With doc
.FormFields("Class").Result = Me!Class
.FormFields("VIN").Result = Me!VIN
.FormFields("VAOpen").Result = Me!VAOpen
.FormFields("VAClose").Result = Me!VAClose
.FormFields("PaySystem").Result = Me!PaySystem
.FormFields("Series").Result = Me!Series
.FormFields("Grades").Result = Me!Grades
.FormFields("SF52Number").Result = Me!SF52Number
.FormFields("SM1").Result = Me!SM1
.FormFields("SM2").Result = Me!SM2
.FormFields("AnnounceType").Result = Me!AnnounceType
.FormFields("AnnounceType").Result = Me!AnnounceType
.FormFields("PlannedHires").Result = Me!PlannedHires
.FormFields("RequestDate").Result = Me!RequestDate
.FormFields("CertNumber1").Result = Me!CertNumber1
.FormFields("CertNumber2").Result = Me!CertNumber2
.FormFields("CertNumber3").Result = Me!CertNumber3
.FormFields("CertIssued").Result = Me!CertIssued
.FormFields("CertDue").Result = Me!CertDue
.FormFields("DutyLocation1").Result = Me!DutyLocation1
.FormFields("DutyLocation2").Result = Me!DutyLocation2


.Activate
End With
Set doc = Nothing
Set appWord = Nothing
Exit Sub

errHandler:
MsgBox Err.Number & ": " & Err.Description
</code>
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,215,079
Messages
6,123,005
Members
449,092
Latest member
masterms

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