Converting VB.NET code to VBScript -


I have this snippet of VB.NET code that I want to convert to VBScript. It basically starts Microsoft Word, displays the Open Dialog and the mail merged into the selected document. Any help would be highly appreciated.

  dim = o.missing object = System.Reflection.Missing.Value dim oEndOfDoc object = "\\ endofdoc" object as in the form of dim oFalse = false 'Start Word and create a new document Word._Application dim oDoc Word._Document oWord = new Word.Application () oWord.Visible = true as "show box Word.Dialog = oWord.Dialogs (Word.WdWordDialog.wdDialogFileOpen) dlg as dim dlgType system As the dim, oWord dim. Type = GetType (Word.Dialog) 'dialog set property box name dlgType.InvokeMember ( "name" is not Reflection.BindingFlags.SetProperty or Reflection.BindingFlags.Public or Reflection.BindingFlags.Instance, some, dlg, New Object () {"C: \ Documents and Settings \ My Documents \ MailMerge \"}, System.Globalization.CultureInfo.InvariantCulture) Dim TimeOut Object = 0 Dim a as Int16 = dlg.Show (timeOut) 'if No documents have been opened. If (a = -1) then oDoc = oWord.ActiveDocument oDoc.Select () oDoc.MailMerge.OpenDataSource ( "C: \\ usr \\ mergequery.txt", oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing , oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing) oDoc.MailMerge.Destination = Word.WdMailMergeDestination.wdSendToNewDocument oDoc.MailMerge.Execute (oFalse) 'Close the original document. ODoc.Saved = true oDoc Close (oFalse, omissing, oMissing) end if  

Here you can go.

  option clear wdDialogFileOpen, wdSendToNewDocument wdDialogFileOpen = 80 wdSendToNewDocument = 0 Smooth OndOffDock oEndOfDoc = "\\ endofdoc" Smooth OWD, oDoc set OWORD = CreateObject ("Word.Application") OWord.Visible = True Dim dlg set dlg = oWord.Dialogs (wdDialogFileOpen) dlg.Name = "C: \ documents and Settings \ My documents \ MailMerge \" Dim AA = dlg.Show (0) 'If a document is opened. If (a = -1) oDoc resets = oWord.ActiveDocument oDoc.Select oDoc.MailMerge.OpenDataSource "C: \ usr \ mergequery.txt" oDoc.MailMerge.Destination = wdSendToNewDocument oDoc.MailMerge.Execute false "Close the original document . ODoc.Saved = true oDoc Close false end if  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -