Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8854049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:47:40+00:00 2026-06-14T13:47:40+00:00

General question: how can functionality in VBA macros created by ‘recording’ in Microsoft Office

  • 0

General question:
how can functionality in VBA macros created by ‘recording’ in Microsoft Office be ‘translated’ into Windows-executable VBScripts that could be in .vbs files?

Specific question:
how to batch create thumbnails of Word documents for viewing in Windows Explorer?

Alternative question:
where can i find documentation on manipulating MS Word documents with VBS?


my final goal is to batch the process of creating thumbnails for MS Word docs.

my humanly-done method is:

  • open a Word doc
  • press ‘save as’
  • tick ‘save thumbnail’
  • save and replace

i found out from a small website that VBS, in the form of .vbs files, can manipulate Word documents. example that can be executed by double clicking the .vbs file in Windows Explorer:

'in a file called "something.vbs"
Set objWord = CreateObject("Word.Application")

objWord.Visible = True
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection

objSelection.Font.Name = "Arial"
objSelection.Font.Size = "18"
objSelection.TypeText "Network Adapter Report"
objSelection.TypeParagraph()

objSelection.Font.Size = "14"
objSelection.TypeText "" & Date()
objSelection.TypeParagraph()

i also found out that by ‘recording macros’, i can get some VBA code that saves a document with a thumbnail. here is a macro that i recorded:

Sub save_with_thumbnail()
'
' save_with_thumbnail Macro
'
'
    ChangeFileOpenDirectory _
        "E:\"
    ActiveDocument.SaveAs2 FileName:="as90520.doc", FileFormat:= _
        wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:= _
        True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:= _
        False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
        SaveAsAOCELetter:=False, CompatibilityMode:=0
End Sub

each of the two approaches solve part of my problems, but i couldn’t integrate them two. therefore i’m asking if anyone –

  • can help integrate/combine/whatever the two approaches by converting what the VBA macro did into a windows-executable script, or
  • can give a suggestion on how to batch create thumbnail for MS Word docs in Windows Explorer, or
  • know of the existence of some reference documentation somewhere that provides more information about this CreateObject.("Word.Application") and .Documents.Add() and .Selection and ..SaveAs – whatever, all sorts.

hope i have worded the question well enough. thanks in advance for any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:47:42+00:00Added an answer on June 14, 2026 at 1:47 pm

    The initial starting point is different. VBA is usually hosted by another application, which provides a set of built-in objects; for example, if your VBA is hosted in Word, you’ll have access to the Word Application which refers to the currently running Word application. In VBS, you have to either create a new Application object and save it in a variable:

    Dim wdApp
    Set wdApp = CreateObject("Word.Application")
    

    or get a reference to an already running Word Application:

    Set wdApp = GetObject(,"Word.Application")
    

    Once you’ve done that, the code between them is virtually interchangeable:

    Dim wdDoc
    Set wdDoc = wdApp.Open("path\to\document.docx")
    

    Bear in mind that in VBA variables can have a type. Instead of the previous variable declaration (Dim wdDoc), in VBA you can see this:

    Dim wdDoc As Word.Document
    'alternatively:
    'Dim wdDoc As Document
    

    Also, VBA generally has access to enum constants, such as wdFormatDocument. In VBScript, you can either define the constants manually:

    Const wdFormatDocument = 0
    

    Or use the value of the constants directly:

    wdApp.ActiveDocument.SaveAs2 FileName:="as90520.doc", FileFormat:= 0
    

    Reference for the Word object model can be found here.


    As far as your specific question goes, ActiveDocument is a property of an Application object, (see here). So in VBS, the corresponding code might look something like this:

    Dim wdApp
    Set wdApp = CreateObject("Word.Application")
    
    'When you open Word from the Start menu, it automatically adds a blank document for you
    'When manipulating Word in a program, we need to do this by hand
    'Generally we would store this in a variable, but we don't need to store it in order
    'to use the ActiveDocument property; it just has to exist
    wdApp.Documents.Add
    
    'copied and pasted from before
    wdApp.ActiveDocument.SaveAs2 FileName:="as90520.doc", FileFormat:= _
        wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:= _
        True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:= _
        False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
        SaveAsAOCELetter:=False, CompatibilityMode:=0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a general question. And may not be specific to datagrids. How can
This question is about a general technique in SQL, that I can't quite work
My question is quite general and some related questions can be found on SO,
I'm having trouble understanding space complexity. My general question is: how can the space
general question is i like to build logger class that writes to single log
General question about java servlets and the best way to handle requests. If I
I have a general question on the class definition and its use..THe below code
Sorry for the fairly general question but I am looking to find out what
I guess my general question which I googled to no luck: Is there a
I have a general question about interpreters of functional languages: Are there actually any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.