Testing a text file in Word Macro

Testing a text file in Word Macro

Post by Mush » Tue, 17 Apr 2007 21:18:44


Hi Guys,

Can any one give suggestions on it please? Ours is a big organisation
with almost 100 printer. I have written macro which checks the driver
name and assign the different trays. I have written if statements for
each printer but in the future if new printers are added I dont want
MAcro to be changed much. So I think it will be good if I store all
the printer details as a text file and test with driver name and
Assign the tray numbers.

Actual Requiremenet: I just want to know how do we test a particular
column of a text file in a Word Macro

Anyone please
 
 
 

Testing a text file in Word Macro

Post by QmVhc » Wed, 18 Apr 2007 00:24:01

Mushy:

I cannot understand your application from the description:


You can certainly store printer details in a table in a Word document, and
open and manipulate the contents of that document and table. You can show the
document or open it "invisibly."

Set docPrinterData = Documents.Open( _
FileName:="Xxx.doc", _
Revert:=False, _
Visible:=False)

and then manipulate docPrinterData.Tables(1)

Bear

 
 
 

Testing a text file in Word Macro

Post by Jonathan W » Wed, 18 Apr 2007 01:38:40


Hi Mushy

There are various options here. The simplest is to use the basic file i/o
commands to get the text of the file into a string variable, and then
manipulate the variable. Take a look at the following commands in the VBA
Help

Open
Line Input
Input #
Get #



--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
 
 

Testing a text file in Word Macro

Post by Mush » Thu, 19 Apr 2007 22:47:29


Thanks Jonathan,

I will look at it