Populate PDF checkbox with Application.SendKeys " "

alxn

New Member
Joined
Jul 17, 2023
Messages
14
Office Version
  1. 365
  2. 2021
  3. 2013
Platform
  1. Windows
I'm trying to populate a PDF document with information inside of my Excel worksheet, I can populate the PDF with regular words such as names and numbers but I need to populate some checkboxes based on the word "TRUE" inside my Excel sheet, I know that by physically hitting the spacebar it will check the checkbox but when using Application.SendKeys " " nothing happens. Any ideas? The PDF app I'm using is PDF Xchange.

**Check boxes inside the PDF document** When I hit the space bar in my keyboard it checks the box

Months.PNG

**Example of Excel sheet I'm using to populate** In this case the word "TRUE" would trigger Application.SendKey (" ")
Months 2.5.PNG

VBA Code:
LastRow = .Range("E9999").End(xlUp).Row  'LastRow
    For CustRow = 2 To 2 'LastRow
    FirstName = .Range("T" & CustRow).Value 'LastName
    EplyrName = .Range("B" & CustRow).Value 'Employer Name

Application.SendKeys "{Tab}", True
    For Each c In Range("CJ" & CustRow).Cells
        If c.Value = "TRUE" Then Application.SendKeys " ", True 'Part iii Check box"
        Application.Wait Now + 0.00001
    Next c
        
    Application.SendKeys "{Tab}", True
    For Each c In Range("CQ" & CustRow).Cells
        If c.Value = "TRUE" Then Application.SendKeys " ", True 'Covered all 12 months?"
        Application.Wait Now + 0.00001
    Next c
    
    Application.SendKeys "{Tab}", True
    For Each c In Range("CR" & CustRow).Cells
        If c.Value = True Then Application.SendKeys " ", True 'Covered January?"
        Application.Wait Now + 0.00001
    Next c
    
    Application.SendKeys "{Tab}", True
    For Each c In Range("CS" & CustRow).Cells
        If c.Value = True Then Application.SendKeys (" "), True 'Covered February?
        Application.Wait Now + 0.00001
    Next c
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,223,879
Messages
6,175,147
Members
452,615
Latest member
bogeys2birdies

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