Export to text file.

  • Thread starter vespasiandamascus
  • Start date
V

vespasiandamascus

Hi everyone.

In a macro I am currently working on, a large amount of data gets
written the Immediate Window. It shows up very messy and unorganized,
so I my question is this: Is there any command in VBA for Visio to
export the data to a text file, word document, or excel spreadsheet,
instead of the immediate window? I have done this before in C++ and
other programming languages, but never with VBA.

Any help would be greatly appreciated!
Thanks in advance,

Damascus
 
J

John... Visio MVP

Hi everyone.

In a macro I am currently working on, a large amount of data gets
written the Immediate Window. It shows up very messy and unorganized,
so I my question is this: Is there any command in VBA for Visio to
export the data to a text file, word document, or excel spreadsheet,
instead of the immediate window? I have done this before in C++ and
other programming languages, but never with VBA.

Any help would be greatly appreciated!
Thanks in advance,

Damascus


You could use the Print # command

Open "c:\TESTFILE" For Output As #1 ' Open file for output.
Print #1, "This is a test" ' Print text to file.
Print #1, ' Print blank line to file.
Print #1, "Zone 1"; vbTab ; "Zone 2" ' Print in two print zones.
Close #1 ' Close file.

You can then open the text file in Word or Excel and you do not have to
worry about the maximum number of lines in the Immediate window. The tab
character, vbtab, will place the entries in different columns if youopen the
file in Excel.

John... Visio MVP
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Top