[nfbcs] Anyone know VBA?

Sarah Jevnikar sarah.jevnikar at gmail.com
Fri Aug 31 21:01:20 UTC 2018


Hi all,
If anyone knows VBA, I need your help.

I have the following situation:
I'm creating accessibility WCAG 2.0 compliance reports. They take the form
of a table, where each row is a WCAG 2.0 Success Criterion. Due to requests
from my colleagues, I've been asked to make available the following
formatting changes, most of which I've been able to achieve with macros
(mainly keystroke-recorded as I don't know VBA)
* colour-code any failed success criteria (done thanks to Google and a
colleague who doesn't know VBA either but can at least read code)
* put failed success criteria into an Excel spreadsheet (done)
* split the 62-row table into 4 smaller ones, each under their own heading
associated with each principle (done)
* Create a separate table of failed success criteria in my main Word
document (here's the trouble)

As I am creating an Excel file already, and Excel has filtering options that
allow me to create a separate "Failed Success Criteria" sheet, which I have
pasted into its own file in Excel, using  Excel to filter out the data seems
to make sense. There's no clear way to do the same in Word. I have the data
I want in Excel, I just need to get it back to Word and into my main
(larger) report.

I thought the best way to achieve this would be if I started in Word, since
most of what I'll be doing with the information is there. In Word I've
opened Excel to the right workbook, but am not sure how to select the range
of cells in that workbook. I then want to copy that selected text into a new
Word document as uncoded plain text, convert that text into a Word table,
give it a heading, and copy the whole damn thing back into my main report.
In case I have also run the macro to split the complete (failed and passed)
table into subsections, I want to change those headings (level 3) into level
4 headings so hierarchy is preserved. A standard find-and-replace should do
the job here I think.

To summarize,
* I want to, from within Word, open an Excel spreadsheet, select and copy
its contents, then paste them into a new Word doc, but can't
* I'd like to convert this text to a table whose size I am not sure of
because the number of rows will change based on the number of failed success
criteria. Recording this with keystrokes seemed to set my number of rows to
a specified digit rather than a relative value.

I've been around in circles on Google. It's helped but not with the
selecting, copying and pasting bit. Am I coming at this from the wrong
angle?

If anyone can help, I'd be grateful. I'm happy to share my source files
etc., as nothing is confidential even though this is a project for my job.

Thank you,
Sarah



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus





More information about the NFBCS mailing list