Anyone know how I can convert a Word 2000 macro into VB6.0 or .Net exe

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

Re: Word macro to VB by Jezebel

Jezebel
Tue Jan 27 00:49:15 CST 2004

VBA and VB are very similar; a lot of the time you need do nothing at all.
Intrinisic commands in Word VBA are actually methods of the Word application
object, so in some cases the conversion is largely along the lines --

Dim pWordApp as object

Set pWordApp = CreateObject("Word.Application")
with pWordApp
.Selection .....
.Bookmarks("MyBookmark").Range ...

etc
end With

However, there are some VBA things that do not work in VB. In particular,
forms are completely different and will have to be re-created.




"Terry" <Terry.10of2j@nospam.WordForums.com> wrote in message
news:Terry.10of2j@nospam.WordForums.com...
>
> Anyone know how I can convert a Word 2000 macro into VB6.0 or .Net exe?
>
>
> ------------------------------------------------
> ~~ Message posted from http://www.ExcelTip.com/
> ~~View and post usenet messages directly from http://www.ExcelForum.com/
>



Re: Word macro to VB by Jonathan

Jonathan
Tue Jan 27 03:45:33 CST 2004

Hi Terry,

Perry's response is correct as far as VB6 is concerned. For VB.NET there may
be more changes you need to make, as there are rather more changes in the
syntax. For instance

- By default paramaters are passed by value rather than by reference
- Integer is now called Short, and Long is now called Integer
- You have to put parentheses round the list of arguments when you make a
subroutine call

--
Regards
Jonathan West - Word MVP
http://www.multilinker.com
Please reply to the newsgroup



"Terry" <Terry.10of2j@nospam.WordForums.com> wrote in message
news:Terry.10of2j@nospam.WordForums.com...
>
> Anyone know how I can convert a Word 2000 macro into VB6.0 or .Net exe?
>
>
> ------------------------------------------------
> ~~ Message posted from http://www.ExcelTip.com/
> ~~View and post usenet messages directly from http://www.ExcelForum.com/
>


Re: Word macro to VB by Perry

Perry
Tue Jan 27 11:13:58 CST 2004

> Perry's response is correct as far as VB6
??

Y're sure you had some coffee before posting yr message, Jonathan?
:-))

Perry

"Jonathan West" <jwest@mvps.org> wrote in message
news:OYkkZRM5DHA.2404@TK2MSFTNGP11.phx.gbl...
> Hi Terry,
>
> Perry's response is correct as far as VB6 is concerned. For VB.NET there
may
> be more changes you need to make, as there are rather more changes in the
> syntax. For instance
>
> - By default paramaters are passed by value rather than by reference
> - Integer is now called Short, and Long is now called Integer
> - You have to put parentheses round the list of arguments when you make a
> subroutine call
>
> --
> Regards
> Jonathan West - Word MVP
> http://www.multilinker.com
> Please reply to the newsgroup
>
>
>
> "Terry" <Terry.10of2j@nospam.WordForums.com> wrote in message
> news:Terry.10of2j@nospam.WordForums.com...
> >
> > Anyone know how I can convert a Word 2000 macro into VB6.0 or .Net exe?
> >
> >
> > ------------------------------------------------
> > ~~ Message posted from http://www.ExcelTip.com/
> > ~~View and post usenet messages directly from http://www.ExcelForum.com/
> >
>



Re: Word macro to VB by Perry

Perry
Tue Jan 27 11:35:23 CST 2004

Talking about converting

You can't safely push a Word macro through a translator- or
converter utility/program to do the converting, if at all possible.

You'll have to code yr way through.
Next to the statements Jonathan contributed, let me
illustrate another feature you need to be aware of:

Where as in ole VB you would instantiate an Automation server
object listed in the MSOffice lib as follows:

Dim wdApp As New Word.Application
This wud go for all Office apps acting as Automation server, also in VBA.

In .NET however, although you can use the same syntax, there are a few
glitches:
You can't terminate a class instantiated as listed above (the old way),
unless you play around with the so called: Garbage Collector
or CType() the object back.

One of the remedies:
Dim wdApp As New Word.ApplicationClass

This is only one example in how .NET differs from the ole VB (...VBA)
syntax;
just wanted to illustrate things you need to be aware of ...

Are we already speaking about "ole VB" ... ??
:-))

To come back to your question:
Yes, you can convert Word macro's to either VB or VB.net BUT ...

Krgrds,
Perry

"Terry" <Terry.10of2j@nospam.WordForums.com> wrote in message
news:Terry.10of2j@nospam.WordForums.com...
>
> Anyone know how I can convert a Word 2000 macro into VB6.0 or .Net exe?
>
>
> ------------------------------------------------
> ~~ Message posted from http://www.ExcelTip.com/
> ~~View and post usenet messages directly from http://www.ExcelForum.com/
>