I had a long list of search-and-replace tasks that I needed to do on a text file. I wanted an easy-to-use tool, so I put together something in Excel using VBA. The tool starts with a “BEFORE replacing” worksheet and then creates an “AFTER replacing” worksheet. The replacements are performed based on a “Definitions of Replacements” worksheet, which directs the macro to replace everything in the first column with a paired item in the second column.
Continue reading “VBA code for performing many searches-and-replaces in an Excel file”
Javascript for Qualtrics: performing mathematical operations on quantitative responses
In Qualtrics, I needed to take a quantitative survey response, do some mathematical operations to the response, and then (1) display the output to the survey respondent and (2) write the output to the Qualtrics dataset. It turns out this is a little tricky, but as described in this post, Javascript can do this task nicely. Continue reading “Javascript for Qualtrics: performing mathematical operations on quantitative responses”
Word VBA code for moving the cursor with a ‘find’
The following VBA code will …
- Search a Word document for “asdf”
- Position the cursor immediately after “asdf”
- Add the letters “jkl;” at the new cursor point
- Move the cursor back four spaces, leaving it immediately after “asdf”
Continue reading “Word VBA code for moving the cursor with a ‘find’”
Searching through Strings in Stata
In Stata, I needed to search some string values. I couldn’t use regular expressions because the strings I’m working with happen to contain regexp control characters. The following Stata code accomplishes the task without regular expressions: Continue reading “Searching through Strings in Stata”
Javascript for Qualtrics to alter choice options
Here is some Javascript code for altering the current question’s multiple-choice options based on the respondent’s answer to a previous multiple-choice question. Specifically, this code considers the response given to a previous question and modifies the current question to remove any answer options that are lower than the previous response. [Note: I hard-coded the number of options as 10. If there are fewer than 10, it will not throw an error.]
Continue reading “Javascript for Qualtrics to alter choice options”
CSS for Qualtrics Questions
Here is some handy CSS for doing highlights, info boxes, and so on within Qualtric questions. I use them in the HTML edit box with a variety of Qualtrics question-types to create “sign-posts” that guide respondents through questionnaires.
Continue reading “CSS for Qualtrics Questions”
CSS in Qualtrics questions
Qualtrics allows in-line Cascading Style Sheets (CCS) in their questions. It’s useful for tweaking the way questions are visually formatted. These are a few CSS formats I keep handy. Continue reading “CSS in Qualtrics questions”
The CSS I add to a new Qualtrics survey
To my eye, the “page width” used by Qualtrics with most of their themes is too narrow. Even on a small-screen laptop, it leaves a lot of side margin. The issue isn’t merely aesthetic; a wider screen gives me a little more room for wider labels above closed-ended response options.
I use the following CSS code to give a little more width to the space Qualtrics uses for survey questions. This code is added in Qualtrics “Look & Feel,” under “Style.”
Response scale for Qualtrics matrix table questions
This is some handy CSS & HTML for creating a five-point response scale in Qualtrics. In terms of guiding respondents, I believe this visual representation of the response scale achieves clarity while emphasizing the important information:
Continue reading “Response scale for Qualtrics matrix table questions”
VBA code for removing all custom animations from a PowerPoint presentation
When I post my PowerPoint slides on my website for my students, I sometimes remove the animations. Animations are nice for controlling when things appear on the screen during the discussion. (Does anyone remember the old technique of covering part of the overhead slide with paper?) However, my purpose in releasing my PowerPoint slides is to give students a record of what we cover in the class discussion, so animations only get in the way for students.
To make it easier for me to create a student version of the slides, I use the following VBA code to delete all the custom PowerPoint animations in a file. Continue reading “VBA code for removing all custom animations from a PowerPoint presentation”