Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5972995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:44:15+00:00 2026-05-22T20:44:15+00:00

I am coding up a VBA script to create & email a table of

  • 0

I am coding up a VBA script to create & email a table of data. And while it does work, it’s also ugly. One thing I’d like to do is resize these columns so they don’t take up the entire width of the page.

The “autosize column” option would be nice, except I don’t see anywhere in the API. Alternatively, I’m open to manually setting the widths of each column. Can someone tell me what code I need to add?

Dim rtNav As NotesRichTextNavigator
Dim rtTbl As NotesRichTextTable
Dim TblHeader_FontStyle As NotesRichTextStyle
Dim TblBody_BackgroundStyle As NotesRichTextStyle
Dim TblHeader_BackgroundStyle As NotesColorObject
Dim TblBody_FontStyle As NotesColorObject

Sub AppendTable()
'Define styles
    Set TblHeader_BackgroundStyle = NtSession.CreateColorObject
        TblHeader_BackgroundStyle.NotesColor = COLOR_DARK_BLUE
    Set TblHeader_FontStyle = NtSession.CreateRichTextStyle
        TblHeader_FontStyle.NotesColor = COLOR_WHITE
        TblHeader_FontStyle.FontSize = 8

    Set TblBody_FontStyle = NtSession.CreateColorObject
        TblBody_FontStyle.NotesColor = COLOR_WHITE
    Set TblBody_BackgroundStyle = NtSession.CreateRichTextStyle
        TblBody_BackgroundStyle.NotesColor = COLOR_BLACK
        TblBody_BackgroundStyle.FontSize = 10
'-----------------------------------------------------
'Make table structure
    NtBod.AppendTable lRowCount:=1, lColumnCount:=5
    Set rtNav = NtBod.CreateNavigator
    Set rtTbl = rtNav.GetFirstElement(RTELEM_TYPE_TABLE)
    rtTbl.Style = TABLESTYLE_TOP
    Call NtBod.AppendStyle(TblHeader_FontStyle)
    Call rtTbl.SetColor(TblHeader_BackgroundStyle)
    rtNav.FindFirstElement (RTELEM_TYPE_TABLECELL)
'The rest of the procedure to navigate the table and insert the data goes here
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:44:16+00:00Added an answer on May 22, 2026 at 8:44 pm

    There is a parameter in the AppendTable method that lets you specify the style for each column, including the width.

    From the AppendTable method documentation:

    Call
    notesRichTextItem.AppendTable(rows%,
    columns% [, labels] [,leftMargin&]
    [, rtpsStyleArray] )

    Parameters:
    rows% Integer. Number of rows in the table.

    columns% Integer. Number of columns in the table.

    labels Array of type String. Optional. Text of labels for a tabbed
    table. The number of array elements
    must equal the number of rows.
    Omitting this parameter appends a
    basic table. Including this parameter
    appends a tabbed table.

    leftMargin& Long. Optional. Left margin of the table in twips.
    Defaults to 1440. The following
    constants are available:

    • RULER_ONE_CENTIMETER (567)
    • RULER_ONE_INCH (1440)

    rtpsStyleArray Array of type NotesRichTextParagraphStyle. Optional.
    Creates a table with fixed-width
    columns and style attributes as
    specified. Omitting this parameter
    creates an auto-width table. The
    array must contain one element for
    each column in the table in sequence.
    Explicitly set the first line left
    margin and left margin, which control
    the start of text relative to the
    start of the column, and the right
    margin, which controls column width.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While coding with sqlite everytime i always had the exact number of parameters and
While coding a JCL , we give SYSOUT and SYSPRINT DD s. Which type
In Access VBA, I want to use values from a Settings table, instead of
I have an array of data that is coming in to the VBA code
While coding, i just asked myself this question : Is this faster : if(false)
I used to do VB and VBA coding, but it's been over 10 years
I would like to use an xml file to create a html email. I
Coding i came around to check for the vararg performance of Java. I write
Coding in Delphi, attaching an OnKeyPress event handler to a TStringGrid: The OnKeyPress event
Coding footer naively, if there's not enough content, then there will be empty space

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.