MS Word VBA Interview Questions and Answers with Examples

Home/100+ VBA Interview Questions and Answers with Examples/MS Word VBA Interview Questions and Answers with Examples
  • MS Word VBA Interview Questions and Answers

MS Word VBA Interview Questions and Answers with Examples

MS Word VBA Interview Questions and Answers explained with Example macros. Here are the list of most frequently asked basic MS Word VBA interview questions. All the questions are answered with simple examples. These questions will help you to answer basic questions to deal with MS Word VBA development.

PREMIUM TEMPLATES LIMITED TIME OFFER

ON SALE80% OFF

BROWSE ALL TEMPLATES

50+ Project Management Templates Pack
Excel PowerPoint Word

VIEW DETAILS

Advanced Project Plan & Portfolio Template
Excel Template

VIEW DETAILS

Ultimate Project Management Template
Excel Template

VIEW DETAILS

20+ Excel Project Management Pack
Excel Templates

VIEW DETAILS

20+ PowerPoint Project Management Pack
PowerPoint Templates

VIEW DETAILS

10+ MS Word Project Management Pack
Word Templates

VIEW DETAILS


Here is the following VBA macro to create a new Word document.
‘Create New Word Document

 Sub Create_Documnent()
    Documents.Add
End Sub
Here is the following VBA procedure to create a word document from the existing word documnet

'Create new word document based on existing word document
Sub Create_Doc_ReadOnly()
    Documents.Add Template:="D:/Test.doc", NewTemplate:=True
End Sub
Here is the following VBA procedure to create a word document as a read only document.

'Open a Existing Word Document (Read Only Document)
Sub Open_Doc_ReadOnly()
    Documents.Open FileName:="D:/Test.doc", ReadOnly:=True
End Sub
Here is the following VBA code to save a word document.

 'Save Word Document if already not saved
Sub Save_Documnent()
    If ActiveDocument.Saved = False Then
        ActiveDocument.Save
    End If
End Sub
Here is the following VBA procedure to SaveAs a word document.

'SaveAs Word Document if already not saved
Sub SaveAs_Documnent()
    ActiveDocument.SaveAs ("d:/Test.doc")
End Sub
Here is the following VBA procedure to create a word document as a read only document.

'Save and Close Document
Sub Save_Close_Document()
  Documents.Close SaveChanges:=wdSaveChanges
  Application.Quit SaveChanges:=wdSaveChanges
End Sub
Here is the following VBA procedure to create a word document as a read only document.

'Close document without save
Sub DoNotSave_Close_Document()
  Documents.Close SaveChanges:=wdDoNotSaveChanges
  Application.Quit SaveChanges:=wdDoNotSaveChanges
End Sub
Here is the following VBA code. It takes cursor to the start of the document.
code:

Selection.HomeKey Unit:=wdStory
Here is the following VBA code. It takes cursor to the end of the document.
code:

	Selection.EndKey Unit:=wdStory
Here is the following VBA code. It takes cursor to the start of the line.
code:

	Selection.HomeKey Unit:= wdLine
Here is the following VBA code. It takes cursor to the end of the line.
code:

	Selection.EndKey Unit:= wdLine
	
Here is the following VBA code. It selects entire word document.
code:

Selection.WholeStory
Here is the following VBA snippet. It selects entire word document.

'Select the current line in a word document
Sub Select_Line_Document()
    Selection.HomeKey Unit:=wdLine
    Selection.EndKey Unit:=wdLine, Extend:=wdExtend
End Sub
Here is the following VBA macro. It changes the font size of third paragraph.

'Change font size of 3rd paragraph
Sub Paragraph_Font_Size_Document()
     ActiveDocument.Paragraphs(3).Range.Font.Size = 10
End Sub

More VBA Interview Questions & Answers:

Here is the link for more VBA Interview Questions and Answers. These are explained for examples.
100+ VBA Interview Questions

LIMITED TIME OFFER - Get it Now!
Advanced Project Plan Excel Template

 
Related Resource External VBA Reference