Rmacros - John Miyamoto's R Macro List HOW TO CIRCUMVENT...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 John Miyamoto's R Macro List, 1/12/02 HOW TO CIRCUMVENT MICROSOFT WORD SECURITY SYSTEMS THAT BLOCK THE USE OF THE R MACROS IN R.DO Sometimes Word will not let you use the macros stored in R.DOT because the security settings on Word forbid the use of macros that originate with other users. If this happens, there is a solution. You can create your own R.DOT template as follows. * Open Rmacros.txt in Word. * Use File Open - Files of Type Template to open your own NORMAL.DOT. Save this file to the name, R.DOT, and then close this file. You may have to destroy (overwrite) the R.DOT file that I have provided to you - if you don't want to do this, store a copy of the original R.DOT file somewhere before overwriting with the new R.DOT that is based on your NORMAL.DOT. * I assume you are now working on your new version of R.DOT. Access the macros dialog from the menus by choosing Tools Macro /Macros. In the macros dialog, set Macros In: to R.DOT. Set the Macro Name: to Dummy. Then click on the Create button. * At this point, you should see: * Sub dummy() dummy Macro Macro created <date> by <name> End Sub * Delete the dummy macro, i.e., everything from "Sub dummy()" to "End Sub". * Leaving the Visual Basic macro editor open, switch to the window containing Rmacros.txt, and copy to thc clipboard all of the Visual Basic code for the R macros. * Switch back to the Visual Basic macro editor, and paste all of the Visual Basic code into the macro editor. * Choose File Save R from the menu for the macro editor, and then close the macro editor. * Finally close R.DOT template. You now have a R.DOT template whose macros ought to be runnable on your computer. To use these macros: * Create a new blank document (File New). * From the menus, choose Tools Templates and Add-Ins. * In the Document Template field, click on the Attach button, and then search for R.DOT. Select R.DOT, and click to Open this template (you should now see it in Document Templates field of the Templates and Add-Ins). Then click on OK. * The R macros should now be available when you use the current file. Try running the RS macro. It should insert the #Section and #EndSection boundaries into your document. *************************************************************** *** Visual Basic Code for R Word Macros Start Below this Line *** *************************************************************** Sub RL() Macro RL copies the current line to the clipboard, transfers control to R, and runs the clipboard contents in R. It uses a kluge, inserting a "#<carriage return>" at the beginning of the set of lines that are copied to the clipboard. This
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Sheet1 Page 2 kluge avoids a strange problem that sometimes arises on some, but not all computer systems where a "1" is automatically inserted as the first symbol in the set of lines that are copied to the clipboard. With ActiveDocument.Bookmarks .Add Range:=Selection.Range, Name:="initial" End With Selection.HomeKey Unit:=wdLine Selection.Extend Selection.GoTo What:=wdGoToBookmark, Name:="initial" Selection.EndKey Unit:=wdLine With ActiveDocument.Bookmarks .Add Range:=Selection.Range, Name:="highlight" End With Selection.HomeKey Unit:=wdLine With ActiveDocument.Bookmarks .Add Range:=Selection.Range, Name:="start" Selection.TypeText Text:="#"
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern