ChrisCione
Board Regular
- Joined
- Aug 27, 2008
- Messages
- 92
- Office Version
- 365
- Platform
- Windows
Here's VBA (which was kindly provided to me) that I use to pass data from an Access record to autocomplete a fillable Word document. Is it possible to "check" a Check Box Form Field in the Word document, vs. just passing through the value of the field? If so, how can I incorporate that code into the sub below?
Code:
Private Sub cmdRepBBGo_Click()
'Download to Rep Broadband Word Templates.
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
Dim strDocFile As String
Select Case Me.cboTemplateRepBB
Case "ERS"
strDocFile = "L:\Bper Spec\Cione\Database Files\Announcement (ERS Rep BroadBand).doc"
Case "ERS - BC"
strDocFile = "L:\Bper Spec\Cione\Database Files\Announcement (ERS Rep BroadBand) BC.doc"
Case "Open"
strDocFile = "L:\Bper Spec\Cione\Database Files\Announcement (OPEN Rep BroadBand).doc"
Case "Open - BC"
strDocFile = "L:\Bper Spec\Cione\Database Files\Announcement (OPEN Rep BroadBand) BC.doc"
Case "Contractual"
strDocFile = "L:\Bper Spec\Cione\Database Files\Announcement (Contractual Rep BroadBand).doc"
Case "Contractual - BC"
strDocFile = "L:\Bper Spec\Cione\Database Files\Announcement (Contractual Rep BroadBand) BC.doc"
End Select
Set doc = appWord.Documents.Open(strDocFile, , True)
With doc
.FormFields("Classification").Result = Me!Classification
.FormFields("ClassCode").Result = Me!ClassCode
.FormFields("JobAnnoID").Result = Me!JobAnnoID
.FormFields("JobAnnoCode").Result = Me!JobAnnoCode
.FormFields("Cert").Result = Me!CertNumber
.FormFields("PositionNumber").Result = Me!PositionNumber
.FormFields("DateClassApproved").Result = Me!DateClassApproved
.FormFields("DateExemptionApprove").Result = Me!DateExemptionApproved
.FormFields("Division").Result = Me!Division
.FormFields("BureauFacility").Result = Me!BureauFacility
.FormFields("WorkCity").Result = Me!WorkCity
.FormFields("WorkCounty").Result = Me!WorkCounty
.FormFields("CountyNumber").Result = Me!CountyNumber
.FormFields("PaySchedule").Result = Me!PaySchedule
.FormFields("PayRange").Result = Me!PayRange
.FormFields("BargainingUnit").Result = Me!BargainingUnit
.FormFields("MinStartingSalaryYr").Result = Me!MinimumStartingSalaryYr
.FormFields("MaxPUASalaryYr").Result = Me!MaximumPUASalaryYr
.FormFields("ProbationTerm").Result = Me!ProbationTerm
.FormFields("ApplicationDeadline").Result = Me!ApplicationDeadline
.FormFields("ERSPostingDate").Result = Me!ERSPostingDate
.FormFields("ERSDeadlineDate").Result = Me!ERSDeadlineDate
.FormFields("WISCJOBSPosting").Result = Me!WISCJOBSPosting
.FormFields("WISCJOBSDeadline").Result = Me!WISCJOBSDeadline
.FormFields("DateReferralsSent").Result = Me!DateReferralsSent
.FormFields("Criteria1").Result = Me!Criteria1
.FormFields("Criteria2").Result = Me!Criteria2
.FormFields("Criteria3").Result = Me!Criteria3
.FormFields("RegisterDate").Result = Me!RegisterDate
.FormFields("WorkingTitle").Result = Me!WorkingTitle
.FormFields("Duties").Result = Me!Duties
.FormFields("KSA").Result = Me!KSA
.FormFields("Specialist").Result = Me!Specialist
.FormFields("Specialist1").Result = Me!Specialist
.FormFields("Specialist2").Result = Me!Specialist
.FormFields("Specialist3").Result = Me!Specialist
.FormFields("SpecialistEmail").Result = Me!SpecialistEmail
.FormFields("SpecialistEmail1").Result = Me!SpecialistEmail
.FormFields("SpecialistEmail2").Result = Me!SpecialistEmail
.FormFields("SpecialistEmail3").Result = Me!SpecialistEmail
.FormFields("SpecialistPhone").Result = Me!SpecialistPhone
.FormFields("SpecialistPhone1").Result = Me!SpecialistPhone
.FormFields("SpecialistPhone2").Result = Me!SpecialistPhone
.FormFields("SpecialistPhone3").Result = Me!SpecialistPhone
.Visible = True
.Activate
End With
Set doc = Nothing
Set appWord = Nothing
Exit Sub
errHandler:
MsgBox Err.Number & ": " & Err.Description
End Sub