Re: storing cell content in a string

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Ed (ed_millis_at_NO_SPAM.yahoo.com)
Date: 11/29/04


Date: Mon, 29 Nov 2004 09:09:45 -0700

Please excuse me for jumping in like this . . .
If you get the document and have no control over the initial creation, can
you capture the settings for that paragraph and define a new style to then
apply elsewhere?

Ed

"Jay Freedman" <jay.freedman@verizon.net> wrote in message
news:nc8kq0hu52u9d56pajmndt8u6ja9tbv6de@4ax.com...
> On Sun, 28 Nov 2004 13:43:53 +0100, Rob <krekmek@hotmail.com> wrote:
>
> >Hi all!
> >
> >I try to store a cell content (text, tab, tab leader #4) in a text
> >string for later use.
> >
> >strCellText = ActiveDocument.Tables(1).Rows(1).Cells(1).Range.Text
> >discards the tab including the leader.
> >
> >strCelltext contains text and vbCr 's only.
> >
> >How does one grab the cell content including tabs and all?
> >
> >TIA - Rob
>
> Hi Rob,
>
> If you use the Asc() function to examine the values of the characters
> in strCellText, you should find that there is a 9 that represents the
> tab, and a 13 and a 7 that together represent the end-of-cell marker.
>
> However, it isn't possible to capture the leader in a string variable.
> For one thing, it isn't a property of the tab (which is a simple
> character, vbTab, with the ASCII value 9) -- it's a property of the
> *tab stop* in the current paragraph.
>
> If you run this code, you'll see what the setting is for the first
> tabstop in the first paragraph in the cell:
>
> Dim oCell As Cell
> Dim ldr As WdTabLeader
> Set oCell = ActiveDocument.Tables(1).Cell(1, 1)
> ldr = oCell.Range.Paragraphs(1).TabStops(1).Leader
> MsgBox ldr
>
> The numbers shown are 1 less than the ones in the Format > Tabs
> dialog, with spaces (None) being 0, dots being 1, dashes being 2, and
> underline being 3. (There are also two kinds you can set from a macro
> that aren't available in the dialog.)
>
> You would have to store the leader value in a separate variable (and
> the same goes for the tabstop's position).
>
> A better idea, if you have control of how the document is initially
> created, is to use a specific paragraph style that has the tabstop
> position and leader defined in it. Get the name of the style of the
> paragraph when you store its text in the string, and reapply that
> style when you use the string later.
>
> --
> Regards,
> Jay Freedman
> Microsoft Word MVP FAQ: http://word.mvps.org



Relevant Pages

  • Re: A string class that dont stretch
    ... using and capture the string data at a certain point, ... This way you'd only be enhancing that control in one place and you are ... I made the database with enough space, but since I can't control it ... the string overflows the column width and causes a database ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: CreateEventProc error
    ... Private Sub BuildDisplayForm(strPath As String, ... Dim qdf As QueryDef, qdfControls As QueryDef ... Dim ctl As Control, ctlLabel As Control, ctlParent As Control ... Dim strFilter As String, strSuffix As String, strParentName As String, ...
    (microsoft.public.access.forms)
  • Re: unable to load WinSocket dll in Excel Visual Basic Editor
    ... in my "com controls" list but as soon as I try to add the winsock control I ... may or not need the alias portion of the library definiation. ... Public Declare Function FtpSetCurrentDirectory Lib "wininet.dll" Alias ... (ByVal hFtpSession As Long, ByVal lpszCurrentDirectory As String, ...
    (microsoft.public.excel.programming)
  • Having trouble with multi-select list box in Access
    ... Const mstrcRange_Begin As String ... name of a control that represents the End part of a range ... On Error GoTo ErrHandler ...
    (microsoft.public.access.gettingstarted)
  • Re: All Menu Navigation
    ... i based the implementation on sample code from http://www.asp.net/CSSAdapters/Menu.aspx, which shows how to create decent HTML for a Menu control bound to a SiteMapDataSource. ... public void RenderBeginTag(HtmlTextWriter writer, string cssClass) ... static public void RemoveProblemTypes ...
    (microsoft.public.dotnet.framework.aspnet)