Microsoft Word Visual Basic and Macros


Jump to:

Introduction:


(Back)

Microsoft Word is an exceptionally power program. When coupled with a rich set of macros, tedious hours are save which may be better applied to doing something useful. Only you know how you use Word, but customizing a lot of pulldown menus and keystrokes into Macro Buttons for things you do all the time can be a great time saver.

Practically and sequence, like opening a remote file and importing the first three paragraphs can be made possible provided you use the keyboard shortcut keys to advance the selection area.



ShortCut Keys:

LEFT ARROW
One character to the left
RIGHT ARROW
One character to the Right
CTRL+LEFT ARROW
One word to the Left
CTRL+RIGHT ARROW
One word to the Right
CTRL+UP ARROW
One paragraph up
CTRL+DOWN ARROW
One paragraph down
SHIFT+TAB
One cell to the left (in a table)
TAB
One cell to the right (in a table)
UP ARROW
Up one line
DOWN ARROW
Down one line
END
To the end of a line
HOME
To the beginning of a Line
ALT+CTRL+PAGE UP
To the top of the window
ALT+CTRL+PAGE DOWN
To the end of the window
PAGE UP
Up one screen (scrolling)
PAGE DOWN
Down one screen (scrolling)
CTRL+PAGE DOWN
To the top of the next page
CTRL+PAGE UP
To the top of the previous page
CTRL+END
To the end of a document
CTRL+HOME To the beginning of a document
SHIFT+F5
To a previous revision
SHIFT+F5
To the location of the insertion Point
when the document was last closed



Jump to topics:

Templates:




Salkows Macros


Forms and Snippets shown on this page are in Salkow's Macros




Forms:

create_dir_list_form.gif

superfind.gif

find_and_replace.gif



(TOP) (Back)

Real life examples go a long way toward help the new macro buider realise some of the complexities of Word macros. Because the scripting includes system calls and imort and export of files, practically, there are no limitations as to what may be accomplished.



Snippets:

GOOGLE

Sub google_advanced_search()
On Error Resume Next
'pops up a advanced google search in Explorer
'http://www.google.com/advanced_search?hl=en&num=100
Dim idum As Integer
Dim cmd, qquote, browser_File_Spec, WebAddress As String
qquote = Chr$(34) 'needed to parse a space in Program Files'
'change browser next line down, if not explorer
browser_File_Spec = qquote + "C:\Program Files\Internet Explorer\IEXPLORE.EXE" + qquote
cmd = browser_File_Spec + " " + WebAddress 'NEED SPACE HERE IF NETSCAPE
WebAddress = "http://www.google.com/advanced_search?hl=en&num=100"
cmd = browser_File_Spec + " " + WebAddress 'NEED SPACE HERE IF NETSCAPE
'Debug.Print cmd
idum = Shell(cmd, vbMinimizedNoFocus)

End Sub


Paste Device Independent Image Floating

Sub PasteImage()
'
' Paste Device Independent Image Floating
' Macro recorded 12/8/2003 by Steven Salkow
'
Selection.PasteSpecial Link:=False, DataType:= _
wdPasteDeviceIndependentBitmap, Placement:=wdFloatOverText, DisplayAsIcon _
:=False
End Sub


(TOP) (Back)

Recording a Macro

Start with making the Visual Basic Toolbar visible because that show the macro buttons.


turn_on_visual_basic_toolbar.gif

start_macro.gif

macro_stop_recording_when_done.gif

macros_show_macros_from_menu.gif

view_macro.gif

(TOP) (Back)


Making a Macro Button Appear on Your Toolbar

Right Click on the Toolbar area and select CUSTOMIZE (Bottom of Menu)

right_click_word_toolbar_customize.gif

macro_drag_to_word_toolbar.gif

edit_macro_name_after_drag_drop.gif

(TOP) (Back)

Troubleshooting Problems

Macro security warnings

Macro security warnings

How to put Buttons and Text windows right on Word documents

First step is make the Visual Basic Tool bar visible. Next, enter the design mode, and activate the tool box.
Place a button where the cursor is, right click to access its properties; there, change its Caption and properties, like width and Font size etc. See pictures below.

Design_mode_view_Microsoft_word.gif

button_properties.gif

Final Form:
form_doc2_example.gif

Power Point Presentation

Available to Lockheed Personnel Only

Course Handouts


Home Page Previous Next


(TOP)
Intranet Website -
For information or questions regarding this web page, please contact Steve Salkow