Testing a text file in Word Macro

M

Mushy

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
 
B

Bear

Mushy:

I cannot understand your application from the description:
Actual Requiremenet: I just want to know how do we test a particular
column of a text file in a Word Macro

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
 
J

Jonathan West

Mushy said:
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

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
 
M

Mushy

Hi Mushy

There are various options here. The simplest is to use the basicfilei/o
commands to get thetextof thefileinto a string variable, and then
manipulate the variable. Take a look at the following commands in theVBA
Help

Open
Line Input
Input #
Get #

--
Regards
Jonathan West - Word MVPwww.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep yourVBAcode safe, sign the ClassicVB petitionwww.classicvb.org

Thanks Jonathan,

I will look at it
 

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