Ahh yes... that make sense.
So should he create a module in the application and declare fSO and ts
there globally so that they can be utilized in each sub....
In module:
Global fso As New FileSystemObject
Global ts As TextStream
Public Sub Main()
fso.CreateTextFile("C:\SomPath\SomeFile.txt",True)
set ts = fso.OpenTextFile("C:\SomePath\SomeFile.txt")
ts.writeline "TEST"
ts.close
set ts = Nothing
End Sub
Tim
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Lawrence,
Mitchell
Sent: Tuesday, January 29, 2008 9:30 AM
To: [email protected]
Subject: RE: [Talk] CreateObject questions.
I believe he will still need to declare "ts" globally in order to have
that variable populated from sub to sub (rules based scripting).
Thank you,
Mitch Lawrence
Lead Applications Analyst
Technical Support - NPR/Automation
CHRISTUS Information Management
(tm): [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
Send a "thank you
<http://intranet.christushealth.org/spiritBuck/Default.asp> " to
someone!
________________________________
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of TIMOTHY B. FRANCE
Sent: Tuesday, January 29, 2008 11:23 AM
To: [email protected]
Subject: RE: [Talk] CreateObject questions.
Hi,
You should open a text stream to the newly created file.
Dim fso as new filesystemobject
Dim ts as TextStream
Dim tmpFile as string
tmpFile = "C:\Logs\SomeFileName.txt")
Fso.createtextfile(tmpfile,true)
Set ts= fso.OpenTextFile(tmpfile,ForAppending)
Ts.writeline "TEST"
Ts.writeline "TEST2"
Ts.close
Set ts=Nothing
Tim
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bennett, Brian
Sent: Tuesday, January 29, 2008 8:45 AM
To: '[email protected]'
Subject: [Talk] CreateObject questions.
Morning all.
If I do the following in step 1:
Set fs = CreateObject ("Scripting.FilesystemObject")
Set a = fs.CreateTextFile ("c:\logs\somefilename.txt", True)
And then in step 2:
a.WriteLine ("Some text goes here")
a.WirteLine ("Some more text goes here")
I get an error in step 2 since I have left the sub in step 1. Do I need
to Dim a as ?, or do I need to set a= fs before I can write to a, for
each step that I need to write to?
Thanks.
Brian Bennett
Affinity Health Systems
PBS\Clinic Billing
(920)628-9055
[EMAIL PROTECTED]
________________________________
CONFIDENTIALITY NOTICE: This message and any included attachments are
from Salinas Valley Memorial Hospital and are intended only for the
addressee. The information contained in this message is confidential and
may constitute inside or non-public information under international,
federal, or state securities laws. Unauthorized forwarding, printing,
copying, distribution, or use of such information is strictly prohibited
and may be unlawful. If you are not the addressee, please promptly
delete this message and notify the sender of the delivery error by
e-mail or you may call Salinas Valley Memorial Healthcare System's
Privacy Officer in Salinas, California, U.S.A at (+1) (831) 755-0751.
CONFIDENTIALITY NOTICE: This message and any included attachments are from
Salinas Valley Memorial Hospital and are intended only for the addressee. The
information contained in this message is confidential and may constitute inside
or non-public information under international, federal, or state securities
laws. Unauthorized forwarding, printing, copying, distribution, or use of such
information is strictly prohibited and may be unlawful. If you are not the
addressee, please promptly delete this message and notify the sender of the
delivery error by e-mail or you may call Salinas Valley Memorial Healthcare
System's Privacy Officer in Salinas, California, U.S.A at (+1) (831) 755-0751.
<<image001.jpg>>
