Developer FAQs - Tools

Welcome to Baarns Publishing's Word Developers FAQ section. If you develop in Microsoft Word using Word Basic, these tips are for you. Feel free to copy any of the code you find here and use in your development projects.


How do I find the cell position in a table?

How do I mail merge to printer without having the user be prompted by the print dialog?

 

How do I find the cell position in a table?
Keywords: Table Cell Position
Posted April 5, 1996

WordBasic has a function called SelInfo (Selection Information) that returns information about the current selection. Parameter 12 through 18 deal with selections within a table. Below are two examples. GetRow returns the row the number the selection is currently in. If the selection contains more than 1 row, -1 is returned. GetColumn is similar to GetRow except that it relates to columns.

Function GetRow
    if SelInfo(12) then
        'Only valid if the selection is within one row of a table.
        if SelInfo(13) = SelInfo(14) then
            GetRow = SelInfo(13)
        Else
            GetRow = -1
        End if
    Else
        GetRow = -1
    End if
End Function
Function GetColumn
    If SelInfo(12) Then
        'Only valid if the selection is within one Column of a table.
        If SelInfo(16) = SelInfo(17) Then
            GetColumn = SelInfo(16)
        Else
            GetColumn = - 1
        End If
    Else
        GetColumn = - 1
    End If
End Function

How do I mail merge to printer without having the user be prompted by the print dialog?
Keywords: Mail Merge Printer
Posted April 4, 1996

The solution is to mail merge to document, then do a FilePrintDefault. When printing is completed, execute FileClose 2. This closes the file without saving the file.

Example:

    MailMergeToDoc
    ToolsOptionsPrint .Background = 0     'Turn background printing off.
    FilePrintDefault
    ToolsOptionsPrint .Background = 1     'Turn background printing back on.
    FileClose 2

Back to Top


Back Back to the FAQ Table of Contents


  Random Thoughts...
Access denied--nah nah na nah nah!


Copyright© 1996-1999, Baarns Consulting Group, Inc. - All rights reserved.