VBA to show/hide data in Word - vba

I am writing a huge procedural manual and would love to be able to hide/show sections as needed. I found the correct way to do it, through bookmarks, check boxes and VBA but am unable to get all three to come together.
These are the instructions I am using:
Link to Instruction Sets
They seem simple enough but I am unable to "view code" by right clicking on the checkbox. Is this a necessary step to add the code or can I just open a new macro and insert the code there?
Other ideas to achieve hiding/showing sections with bookmarks are welcome, too. Thank you!

Related

VBA PPT Event triggered when chart is added

I am trying to write an VBA-Code that triggers whenever a chart is added in PPT. So far I found
this list: Link. However the options don't work, I thought maybe using "AfterShapeSizeChange", since it comes kind of close. But even this event does not work/trigger.
Anybody has an idea what I could use?
Kind regards

How to create a new custom style with specific heading

Please help as I am new to Vba and custom style in MS Word 2013.
I want to create a new custom style that provides heading as INTRODUCTION when a paragraph is been selected, and the rest of the text should come in normal style of paragraphs. Is this possible to make it in custom style or should Vba macro be used. If Vba macro is the only option then how can we add this into the particular custom file.
Styles are for formatting only, they don't contain text (such as INTRODUCTION). If I understand your request, you will need a simple macro you can write, or, actually, record.
So, let's say you have a paragraph in your document. You would like to make this paragraph have the "Normal" style. You would like to insert BEFORE this paragraph the word "INTRODUCTION", and give it the style "Heading 1".
Record the Word macro: InsertIntroduction
Position the cursor at the start of the paragraph.
Enable "Record a macro" - varies by release of Word, but, for 2010, View > Macro > Record. Be sure to specify a good name and a carefully thought out Description. Do NOT shirk this step! Put in the Description! If you are going to use it a lot, assign a keystroke to it also, that will save you a lot of time.
Type INTRODUCTION. Using cursor keys (not mouse), select it (perhaps up-arrow, Home, Shift-End). Apply style "Heading 1" (for this, you can use the mouse: Home > Style group > Heading 1 or a keystroke, usually Ctrl-Alt-1).
Arrow down to the next paragraph. Select the full paragraph using the keyboard, not the mouse (perhaps by hitting the F8 key four times, then ESC).
Apply the appropriate style (again, you can use the mouse, but the Normal style is usually linked to Ctrl-Shift-N).
You've completed the steps you wanted, based on your original request. Note that you can add a lot more, of course. But, let's say you're done.
View > Macro > Stop recording.
You've now written a program and it will be saved. Use it going forward. Cool, hunh? And you can write these things a lot faster yourself than asking others "how do I...?"
Like any other program, it can be modified to do more, or fix little errors. Let's say you misspelled INTRODuCTIoN. Tap Alt-F11 to see your program. Adjust.
9 steps seems like a lot, but, believe me, it's easier done than said. Give it a try. Do it carefully. In theory, if you make a mistake, you can simply modify the program to fix it. But, at your level of experience, you may find it easier to simply Stop recording and start over.
To Use Macro
Position cursor at start of relevant paragraph.
Execute macro. If you took my advice and assigned it to a keystroke, just tap the keystroke. If not, tap Alt-F8 to see a list of your macros. Select the one you want, and click Run.

How to programmably select elements of a Word document and copy to Excel

Is there a way to get some sort of collection of "paragraphs, images, headings1, headings2" and other "word elements" with a VBA function call. I was looking into this, I ran accros ActiveDocument.fields, but it doesn't seem to be it.
What I need to do is copy these elements, one by one, into an excel document, but I do not know how to access them in the first place. Is there any collection or what would be the syntax for accessing these. My idea is to make a loop and use it there, I could be going about this wrong.
In Word:
Hit Alt+F11 to get the VB editor.
Hit F2 to get the Object Browser.
Type "Document" into the search box and hit Enter.
Click on the row that says "Word" under Library and "Document" under Class.
In the "Members of 'Document'" list you will see all sorts of goodies! That includes things like Document.Paragraphs :) . You can then search on MSDN for details of how to use the listed fields. Prepare for lots of searching and reading online!
Once you have found the fields you are interested in, you will be able to try some things. Once you have code that almost works, but not quite, you will be ready to post detailed questions here asking for further help. See the SO tour for more on that process.

How to disable following hyperlinks

Is it possible (perhaps with a VBA macro) to disable Excel from automatically following hyperlinks in the spreadsheet?
Excel's default, which seems not changeable and is very highly annoying, is "click to follow, hold to edit". I would be perfectly happy with a macro that would intercept any "follow the link" signals and either ignore them or convert to "edit cell", but my VBA experience is quite rudimentary, so any help would be much appreciated. Thanks!
Some solutions I have been able to find involve:
writing a macro to convert all links into plain text,
setting autocorrect options to prevent new ones from being created
I would prefer not to go that route.
Not sure if the answer is a simple as this... I use this myself as a button in my quick lauch bar...
Sub removehyperlink()
Selection.Hyperlinks.Delete
End Sub

How add text in PowerPoint which on click is replaced by a cursor?

Everybody knows "Click to Add Title" in the first page of the PowerPoint slide - the moment you click on it, the text disappears. This is very useful feature for creating templates. Does anybody know how to mimic this behavior? Is it a standard functionality or requires some VBA code? If so how to get this effect.
Yes, there are a few different methods to do this. As said, placeholders are one way, and if you go into the Open XML document (rename the ext. of your file to .zip), you can even change the words "Click to Add Title". Another way is to use text boxes and a macro to simulate this.