Write to file

Im trying to write vba code for MS Word that will send all the text that is being typed in the word document to a .txt file on the c:. How do i do this?

Also is there a way of writing to standard output (DOS) from vba?

Thank you

Comments

  • : Im trying to write vba code for MS Word that will send all the text that is being typed in the word document to a .txt file on the c:. How do i do this?
    :
    : Also is there a way of writing to standard output (DOS) from vba?
    :
    : Thank you
    :
    There's several ways how to do this, more or less destroying saved data.
    [code]
    dim iFile as integer
    iFile = FreeFile()
    Open "C:file.txt" For Binary Access Write As #iFile
    Put #iFile, , "Text to be written" [green]'For example[/green]
    Close #iFile
    [/code]
    Text to be written will be written, who gues so :) If you want whole text from MS Word, use for example ActiveDocument.Range.Text instead of "Text to be written"

    Hope this helps..

    [blue][b][italic][size=4]P[/size]avlin [size=4]II[/italic][/size][/b][/blue]

    [purple]Don't take life too seriously anyway you won't escape alive from it![/purple]


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion