Posts Tagged ‘Microsoft’

Windows 10: Clear Clipboard

Monday, June 24th, 2019

During my workflow I sometimes have to copy a series of images from a remotely accessed computer (running Windows 7) to a file on my main computer (running Windows 10). I have noticed an intermittent problem where I go to copy a second image and when I paste I still get the first image, as if the clipboard was never replaced. This can be quite frustrating if the images are similar enough that I don't notice the problem until later, and I have to go back and re-process data to generate the image that did not copy correctly.

I don't know if this is a problem with Windows 10, or something about trying to get Windows 10 and 7 to work together, or something in the remote desktop access software. The way I have found to get around this is to clear out the clipboard on my host computer, and then copying works again.

To add a shortcut to the Windows 10 desktop that clears the clipboard, use the following procedure:

  1. Right click on the desktop and choose "New > Shortcut".

  2. A pop-up asks for the location of the item, enter the text:
    C:\Windows\System32\cmd.exe /c echo off | clip
    Then click "Next".

  3. Give it a name, like "Clear Clipboard", then click "Finish".
  4. Optional - Change the icon: Right click on the shortcut and select "Properties". Click on the "Change Icon ..." button. Click on "Browse", select an icon file (look in C:\Windows\system32\SHELL32.dll for a large selection).
  5. Optional - Give it a keyboard shortcut: In the "Properties" window, click on the "Shortcut key" box and type a letter, the shortcut will become Control + Alt + the letter.

Macro for Chemical Notation in MS Word

Monday, April 29th, 2019

If you ever find yourself entering chemicals formulas1 into a Microsoft Word document you will quickly realize that it is much harder than it needs to be. Either you switch back and forth between the keyboard and the mouse to click "subscript", or use the keyboard shortcut Ctrl-(=), or enter the formula and then go back and select all the numbers (using Ctrl-mouse) and then set them to subscript all at once - all of these are too much work, especially if you have a large number of formulas to enter. It is much better to use the following macro to make formatting a chemical formula just take a couple keystrokes. (Direction for installing into Microsoft Word are below.)

#******************************#
Sub ChemNotation()
'
' Chemnotation Macro
'
'
Set myrange = Selection.Words(1)

If (Len(myrange) < 2) Then
Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
Set myrange = Selection.Words(1)
End If

For i = 1 To Len(myrange)
Char = Mid$(myrange, i, 1)
If (IsNumeric(Char)) Then
myrange.Characters(i).Font.Subscript = True
Else
myrange.Characters(i).Font.Subscript = False
End If
Next i

Selection.MoveRight Unit:=wdCharacter, Count:=1
With Selection.Font
.Subscript = False
End With

End Sub
#******************************#

Directions:

  • Open Microsoft Word

  • Go to the "View" tab in the ribbon
  • Click on the "Macros" button ("view macros", or click Alt-F8)
  • Type the name "ChemNotation" in the Macro name box, then click "Create"
  • Copy and paste the text above into the editing field
  • Open File->Options->Quick Access Toolbar (or right click on the ribbon and select "customize Quick Access Toolbar")
  • Use the drop down box "Choose commands from" to select "Macros", add the macro to the toolbar
  • Select the macro and click "Modify", change the name and icon as desired
  • To use the macro: type in the formula, then either with the cursor at the end of the formula or after selecting the formula, click alt, then click the number on the icon in the toolbar ((I have found that in normal writing I can type the formula and hit Alt, shortcut-number (3 on my quick access bar), but if I am working in a table cell then it only works if I have selected the formula beforehand.
  1. Things like H2O, CO2, or C14H28O2. []