Solved

VBA translation of word macro.

Posted on 2004-08-22
4
533 Views
Last Modified: 2012-08-13
Dear Experts,

I need to translate a certain word macro. I heard it might be difficult.

I am an extreme new-bie for VB. I am suggested to use VBA. I dont know how VBA differs from VB.

I hope you might have suggestion for me in translating a certain word macro using VBA.

Thanks.
0
Comment
Question by:ldbkutty
  • 2
  • 2
4 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 11865048
Word macros always use VBA, unless it was for Word 6 or earlier, which used Wordbasic.
VB6 and VBA code for Office 2000 are basically the same.

The environment is different so you have to get hold of the Word Objects to run the code for you.

I suggest that you set a reference (Project/References) to the Microsoft Word Object library, then

Dim wdAppl as Word.Application
Dim Doc as Word.Document
Set wdAppl as New Word.Application
Set Doc = wdAppl.Documents.Open("C:\myfolder\mydoc.doc")

Within Word the Application object is implicit and need not be stated. If it is the keyword Application is always used.

the equivalent of the last line could be

either
Set Doc = Application.Documents.Open("C:\myfolder\mydoc.doc")
or
Set Doc = Documents.Open("C:\myfolder\mydoc.doc")

It might  be an idea to post some of the code (or all if it isn't very long)
0
 
LVL 32

Author Comment

by:ldbkutty
ID: 11902860
Thanks for your help and Sorry for this late reply. I am out of this task now. I hope to get back in 2 or 3 days.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 11908036
OK.
Looking forward to it.
Graham
0
 
LVL 32

Author Comment

by:ldbkutty
ID: 11937635
Seems it will take time for me to get the word macro. I'll close the Question now and come back with some new Q Links.

Thanks.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question