Skip to main content

[Migrated content. Thread originally posted on 26 September 2003]

Could anyone help me with translating of Vb codes for the Word Control below? I was able to do some but not all of them, ones with ???. Thanks


_______________
Set wrdMailMerge = wrdDoc.MailMerge
'INQUIRE wrdDoc MailMerge IN wrdMailMerge.

Dim oAutoText As Word.AutoTextEntry
???
Set oAutoText = oApp.NormalTemplate.AutoTextEntries.Add("MyLabelLayout", oDoc.Content)
???
oDoc.Content.Delete
'Modify oDoc Content::Delete()

odoc.Mailmerge.MainDocumentType = wdMailingLabels
'Modify wrdMailMerge MainDocumentType = wdMailingLabels

odocMailmerge.OpenDataSource Name:=" name.txt"
'Modify wrddoc MailMerge::OpenDatasource("name.txt")

oApp.MailingLabel.CreateNewDocument Name:="5160", Address:="", AutoText:="MyLabelLayout", LaserTray:=wdPrinterManualFeed
'Modify wrdApp MailingLabel::CreateNewDocument( by name Name "5160" by name Address "" by name "MyLabelLayout" by name LaserTray wdPrinterManualFeed)

odoc.MailMerge.Destination = wdSendToNewDocument
'Modify wrdMailMerge Destination = wdSendToNewDocument

odoc.Execute
'modify wrdMailMerge Execute(1)

oAutoText.Delete
???
oDoc.Close False
'modify wrdDoc Close()

oApp.Visible = True
'Modify wrdApp @Visible = 1

oApp.NormalTemplate.Saved = True
???
____________________

[Migrated content. Thread originally posted on 26 September 2003]

Could anyone help me with translating of Vb codes for the Word Control below? I was able to do some but not all of them, ones with ???. Thanks


_______________
Set wrdMailMerge = wrdDoc.MailMerge
'INQUIRE wrdDoc MailMerge IN wrdMailMerge.

Dim oAutoText As Word.AutoTextEntry
???
Set oAutoText = oApp.NormalTemplate.AutoTextEntries.Add("MyLabelLayout", oDoc.Content)
???
oDoc.Content.Delete
'Modify oDoc Content::Delete()

odoc.Mailmerge.MainDocumentType = wdMailingLabels
'Modify wrdMailMerge MainDocumentType = wdMailingLabels

odocMailmerge.OpenDataSource Name:=" name.txt"
'Modify wrddoc MailMerge::OpenDatasource("name.txt")

oApp.MailingLabel.CreateNewDocument Name:="5160", Address:="", AutoText:="MyLabelLayout", LaserTray:=wdPrinterManualFeed
'Modify wrdApp MailingLabel::CreateNewDocument( by name Name "5160" by name Address "" by name "MyLabelLayout" by name LaserTray wdPrinterManualFeed)

odoc.MailMerge.Destination = wdSendToNewDocument
'Modify wrdMailMerge Destination = wdSendToNewDocument

odoc.Execute
'modify wrdMailMerge Execute(1)

oAutoText.Delete
???
oDoc.Close False
'modify wrdDoc Close()

oApp.Visible = True
'Modify wrdApp @Visible = 1

oApp.NormalTemplate.Saved = True
???
____________________
Assuming your question marks identify the lines you need help with:

WORKING-STORAGE SECTION.

*Dim oAutoText As Word.AutoTextEntry
77 oAutoText HANDLE OF AutoTextEntry.
77 oApp HANDLE OF Application.
77 oDoc HANDLE OF Document.
77 oRange HANDLE OF Range.

PROCEDURE DIVISION.
APP-MAIN SECTION.
APP-MAIN-001.

*Create the Word OLE object and instantiate a connection to it.
CREATE APPLICATION OF WORD
HANDLE IN oApp.
*Set oAutoText = oApp.NormalTemplate.AutoTextEntries.Add("MyLabelLayout", oDoc.Content)
*You need all the three next lines to accomplish this one in ACUCOBOL-GT
MODIFY oApp Documents::Add()
GIVING oDoc.
INQUIRE oDoc Content IN oRange.
MODIFY oApp
NormalTemplate::AutoTextEntries::Add(
"MyLabelLayout",
oRange)
GIVING oAutoText.

*oAutoText.Delete
DESTROY oAutoText.
DESTROY oRange.
DESTROY oDoc.
*oApp.NormalTemplate.Saved = True
MODIFY oApp NormalTemplate::Saved = 1.
MODIFY oApp Quit().
STOP RUN.

APP-MAIN-EXIT.
EXIT.

Hope this helps.

[Migrated content. Thread originally posted on 26 September 2003]

Could anyone help me with translating of Vb codes for the Word Control below? I was able to do some but not all of them, ones with ???. Thanks


_______________
Set wrdMailMerge = wrdDoc.MailMerge
'INQUIRE wrdDoc MailMerge IN wrdMailMerge.

Dim oAutoText As Word.AutoTextEntry
???
Set oAutoText = oApp.NormalTemplate.AutoTextEntries.Add("MyLabelLayout", oDoc.Content)
???
oDoc.Content.Delete
'Modify oDoc Content::Delete()

odoc.Mailmerge.MainDocumentType = wdMailingLabels
'Modify wrdMailMerge MainDocumentType = wdMailingLabels

odocMailmerge.OpenDataSource Name:=" name.txt"
'Modify wrddoc MailMerge::OpenDatasource("name.txt")

oApp.MailingLabel.CreateNewDocument Name:="5160", Address:="", AutoText:="MyLabelLayout", LaserTray:=wdPrinterManualFeed
'Modify wrdApp MailingLabel::CreateNewDocument( by name Name "5160" by name Address "" by name "MyLabelLayout" by name LaserTray wdPrinterManualFeed)

odoc.MailMerge.Destination = wdSendToNewDocument
'Modify wrdMailMerge Destination = wdSendToNewDocument

odoc.Execute
'modify wrdMailMerge Execute(1)

oAutoText.Delete
???
oDoc.Close False
'modify wrdDoc Close()

oApp.Visible = True
'Modify wrdApp @Visible = 1

oApp.NormalTemplate.Saved = True
???
____________________
Assuming your question marks identify the lines you need help with:

WORKING-STORAGE SECTION.

*Dim oAutoText As Word.AutoTextEntry
77 oAutoText HANDLE OF AutoTextEntry.
77 oApp HANDLE OF Application.
77 oDoc HANDLE OF Document.
77 oRange HANDLE OF Range.

PROCEDURE DIVISION.
APP-MAIN SECTION.
APP-MAIN-001.

*Create the Word OLE object and instantiate a connection to it.
CREATE APPLICATION OF WORD
HANDLE IN oApp.
*Set oAutoText = oApp.NormalTemplate.AutoTextEntries.Add("MyLabelLayout", oDoc.Content)
*You need all the three next lines to accomplish this one in ACUCOBOL-GT
MODIFY oApp Documents::Add()
GIVING oDoc.
INQUIRE oDoc Content IN oRange.
MODIFY oApp
NormalTemplate::AutoTextEntries::Add(
"MyLabelLayout",
oRange)
GIVING oAutoText.

*oAutoText.Delete
DESTROY oAutoText.
DESTROY oRange.
DESTROY oDoc.
*oApp.NormalTemplate.Saved = True
MODIFY oApp NormalTemplate::Saved = 1.
MODIFY oApp Quit().
STOP RUN.

APP-MAIN-EXIT.
EXIT.

Hope this helps.