Want to become an expert in VBA? So this is the right place for you. This blog mainly focus on teaching how to apply Visual Basic for Microsoft Excel. So improve the functionality of your excel workbooks with the aid of this blog. Also ask any questions you have regarding MS Excel and applying VBA. We are happy to assist you.

Dealing with word documents

Open excel work book.

press Alt+F11

tools > References >

put tick on "Microsoft word 15.0 object library"

Write below code

    Dim wApp As Word.Application
    Dim wDoc As Word.Document
    Set wApp = CreateObject("Word.Application")
    wApp.Visible = True

'Here only the word application will be opened.

if you put following line next a new word document will be created.

Set wDoc = wApp.Documents.Add

If you want to open a document in your hard drive ( (Location -D:\VBA LAB\Result.docx) ) you need to put following code

  Set wDoc = wApp.Documents.Open("D:\VBA LAB\Result.docx")

Contact Form

Name

Email *

Message *

Popular Posts