Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Translate a VB module
Message
From
23/01/2001 23:26:52
 
 
To
23/01/2001 14:39:10
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00467503
Message ID:
00467753
Views:
15
Hi Rich,

First off, the DoEvents more or less passes control to Windows to see if anything is pending there. I don't think it would be needed in a VFP port of the code.

Secondly, the rest of the code is de rigeur Word automation calls. As Mario pointed out, most of the parameters used there are Word constants (those prefixed with "wd").

Third, I have to point out that I think it's rather bad taste to expect the community to write your code for you when a little research in MSDN and Word help would have pointed you in the right direction. If you are going to replace existing code with VFP, then you are going to have to understand the underlying processes; people writing code for you is not going to help you in the long term.

>I have a Fox2.6 application I support. The way printing is done is by putting information in a series of tables. A Visual Basic program then polls those tables and does the printing. I want to convert that VB application to VFP but my VB skills are virtually non-existent and my VFP skills are what one would expect from a DOSasaurous who has spent 15+ years doing dBase III and Fox 2.6 and the past year lurking here.
>
>At any rate.... Here is a sample of the code from the VB application. I realize I'm asking somebody here to do my job but I would be extremely grateful if one of you could post the equivalent VFP code.
>
>
>Private Sub PrintSeparator(toWord, _
>    ByVal tcOutputDestination, _
>    ByVal tiSepTray, _
>    ByVal tcSepType, _
>    ByVal tcSection)
>    On Error GoTo SeparatorError
>    DoEvents
>    toWord.Documents.Add
>    With toWord.ActiveDocument.PageSetup
>        .FirstPageTray = tiSepTray
>        .OtherPagesTray = tiSepTray
>        .VerticalAlignment = wdAlignVerticalCenter
>    End With
>    With toWord.Selection
>        If tcSepType = "P" Then
>            .InsertBreak Type:=wdPageBreak
>            .InsertBreak Type:=wdPageBreak
>        End If
>        If (tcSection <> "") Then
>            .ParagraphFormat.Alignment = wdAlignParagraphCenter
>            .Font.Bold = wdToggle
>            .Font.Size = 18
>            .TypeText Text:=ConvertSepType(tcSection)
>            .TypeParagraph
>        End If
>    End With
>    DoEvents
>    Select Case tcOutputDestination
>        Case "Printer"
>            toWord.PrintOut
>        Case "Preview"
>            toWord.PrintPreview = True
>            MsgBox "Separator Print Preview Ready"
>    End Select
>    toWord.ActiveDocument.Close (wdDoNotSaveChanges)
>    DoEvents
>    Exit Sub
>SeparatorError:
>    MsgBox "Error:" & Err.Number & vbCr _
>        & "In: PrintSeparator" & vbCr _
>        & "Description: " & Err.Description
>End Sub
>
>
>
>Thanks to all............Rich
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Previous
Reply
Map
View

Click here to load this message in the networking platform