importing a word document into cad 2004

Discussion in 'AutoCAD' started by Figmint, Jul 3, 2007.

  1. Figmint

    Figmint Guest

    I am trying bring a word document into acad 2004. the document starts
    as a rich text file, and i use word to adjust the column with. then i
    am trying to bring it into multiple mtext boxes, each a set number of
    lines long. The problem is that the resulting mtext boxes no
    formating or carriage returns.

    the code i am using:

    Sub spec3()
    Dim FileName As String, y As Variant, x As Variant, z As Variant,
    StartPoint As Variant
    Dim mtex As AcadMText


    'FileName = ThisDrawing.Utility.GetString(1, "Enter name of text file
    ")
    FileName = ThisDrawing.Path & "\" & "15820_BSD.RTF" 'FileName
    StartPoint = ThisDrawing.Utility.GetPoint(, "Select Insertion Point ")
    x = ThisDrawing.Utility.GetDistance(startp, "Select Colume With ")
    y = ThisDrawing.Utility.GetDistance(startp, "Select Colume Hight ")
    z = ThisDrawing.Utility.GetDistance(startp, "Select Desired Gap
    between Columes ")
    Dim wapp As Word.Application, odoc As Word.Document
    Set wapp = Word.Application
    Set odoc = doc.Documents.Open(FileName, , True)
    wapp.Selection.WholeStory
    With Selection.ParagraphFormat
    .RightIndent = InchesToPoints(x / 100)
    .SpaceBeforeAuto = False
    .SpaceAfterAuto = False
    End With
    wapp.Selection.HomeKey wdStory, wdMove
    d = 0
    Dim c(0 To 2) As Double
    c(0) = StartPoint(0) + ((x + z) * d)
    c(1) = StartPoint(1)
    c(2) = 0

    While doc.Selection.Start <> odoc.Bookmarks("\EndOfDoc").Start
    c(0) = StartPoint(0) + ((x + z) * d)
    wapp.Selection.MoveDown wdline, Int(y / 12), wdExtend
    wapp.Selection.EndKey wdline, wdExtend
    Set mtex = ThisDrawing.ModelSpace.AddMText(c, x,
    wapp.Selection.FormattedText)
    mtex.Height = 9
    d = d + 1
    wapp.Selection.MoveRight wdCharacter, 1, mdmove
    Wend

    End Sub


    i have been wracking my brain on this one for a week now and would
    greatly appreciate any help
     
    Figmint, Jul 3, 2007
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.