Coming to this pretty late....
I wonder if this might be useful. It was very useful for me at the time.... I wrote it some time ago :-)
I have an excel version too to dump to a worksheet.
Lisa
Sub subDumpString(strpLine As String, _Optional vpLineNum As Variant)' Dump a string.
Dim intlI As IntegerDim strlLine As StringDim intlICols As IntegerDim intlRows As IntegerDim objlRange As ObjectDim intlCol As IntegerDim intlTableNum As IntegerDim intlRemainder As IntegerDim intlColsDone As IntegerDim strlLineNum As StringDim slChr As String * 1
If IsMissing(vpLineNum) ThenstrlLineNum = "No Line number given"ElsestrlLineNum = "Line " & Str$(vpLineNum)End If
intlTableNum = 0strlLine = strpLineDocuments.Add
Set objlRange = ActiveDocument.ContentWith objlRangeSelection.InsertAfter "Line >" & strlLine & "<" & vbCrLf & vbCrLfSelection.InsertAfter "Length =" & Len(strlLine) & vbCrLf & vbCrLfSelection.InsertAfter strlLineNum & vbCrLf & vbCrLfintlI = 1intlRows = 1intlCol = 12DoIf intlCol > 11 ThenSelection.EndKey Unit:=wdStorySelection.InsertAfter intlI & " To " & intlI + 9 & vbCrLfSelection.EndKey Unit:=wdStoryActiveDocument.Tables.Add _Range:=Selection.Range, _NumRows:=3, _NumColumns:=11, _DefaultTableBehavior:=wdWord9TableBehavior, _AutoFitBehavior:=wdAutoFitFixedSelection.EndKey Unit:=wdStorySelection.TypeParagraphSelection.TypeParagraphintlCol = 2intlTableNum = intlTableNum + 1ActiveDocument.Tables(intlTableNum) _.Cell(1, 1).Range.Text _= "Chr"ActiveDocument.Tables(intlTableNum) _.Cell(2, 1).Range.Text _= "Asc"ActiveDocument.Tables(intlTableNum) _.Cell(3, 1).Range.Text _= "Chr #"End IfslChr = Mid$(strlLine, intlI, 1)ActiveDocument.Tables(intlTableNum) _.Cell(1, intlCol).Range.Text _= slChrActiveDocument.Tables(intlTableNum) _.Cell(2, intlCol).Range.Text _= Asc(slChr)ActiveDocument.Tables(intlTableNum) _.Cell(3, intlCol).Range.Text _= intlISelection.Collapse wdCollapseEndintlCol = intlCol + 1intlI = intlI + 1Loop Until intlI > Len(strlLine)
End With
Set objlRange = Nothing' ***********************************************************************End Sub
Posted by: Rajiv Pathak <rpp31071@yahoo.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (15) |
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar