How should these items be declared?

G

Greg Maxey

What should fLog and moog be declared as in the snippet of code below?

Dim fFolderName As String, filename As String, oFolderPath As String
Dim f As Object
Dim flog
Dim moog

Set f = CreateObject("Scripting.FileSystemObject")
fFolderName = Environ$("APPDATA") & "\~folders" & ".txt"
mFileName = Environ$("APPDATA") & "\~macros" & ".txt"
Set fLog = f.Createtextfile(fFolderName, True)
Set mLog = f.Createtextfile(mFileName, True)

Thanks
 
J

Jean-Guy Marcil

Greg Maxey was telling us:
Greg Maxey nous racontait que :
What should fLog and moog be declared as in the snippet of code below?

Dim fFolderName As String, filename As String, oFolderPath As String
Dim f As Object
Dim flog
Dim moog

Set f = CreateObject("Scripting.FileSystemObject")
fFolderName = Environ$("APPDATA") & "\~folders" & ".txt"
mFileName = Environ$("APPDATA") & "\~macros" & ".txt"
Set fLog = f.Createtextfile(fFolderName, True)
Set mLog = f.Createtextfile(mFileName, True)

Thanks

Dim fLog As TextStream
Dim mLog As TextStream

In the Object Browser (F2), select "Scripting" in the list of libraries.
Then find "FileSystemObject" in the classes and finally click on
"CreateTextFile" in the Members section in the right-hand side pane. At the
bottom, you should see something like:
Function CreateTextFile(FileName As String, [Overwrite As Boolean =
True], [Unicode As Boolean = False]) As TextStream
Member of Scripting.FileSystemObject
Create a file as a TextStream

HTH

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
G

Greg Maxey

Thanks.


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

Jean-Guy Marcil said:
Greg Maxey was telling us:
Greg Maxey nous racontait que :
What should fLog and moog be declared as in the snippet of code
below? Dim fFolderName As String, filename As String, oFolderPath As
String
Dim f As Object
Dim flog
Dim moog

Set f = CreateObject("Scripting.FileSystemObject")
fFolderName = Environ$("APPDATA") & "\~folders" & ".txt"
mFileName = Environ$("APPDATA") & "\~macros" & ".txt"
Set fLog = f.Createtextfile(fFolderName, True)
Set mLog = f.Createtextfile(mFileName, True)

Thanks

Dim fLog As TextStream
Dim mLog As TextStream

In the Object Browser (F2), select "Scripting" in the list of
libraries. Then find "FileSystemObject" in the classes and finally
click on "CreateTextFile" in the Members section in the right-hand
side pane. At the bottom, you should see something like:
Function CreateTextFile(FileName As String, [Overwrite As Boolean =
True], [Unicode As Boolean = False]) As TextStream
Member of Scripting.FileSystemObject
Create a file as a TextStream

HTH
 
G

Greg Maxey

JGM,

I don't have a "scripting" in the list of libaries :-(

Where do I find it?

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

Jean-Guy Marcil said:
Greg Maxey was telling us:
Greg Maxey nous racontait que :
What should fLog and moog be declared as in the snippet of code
below? Dim fFolderName As String, filename As String, oFolderPath As
String
Dim f As Object
Dim flog
Dim moog

Set f = CreateObject("Scripting.FileSystemObject")
fFolderName = Environ$("APPDATA") & "\~folders" & ".txt"
mFileName = Environ$("APPDATA") & "\~macros" & ".txt"
Set fLog = f.Createtextfile(fFolderName, True)
Set mLog = f.Createtextfile(mFileName, True)

Thanks

Dim fLog As TextStream
Dim mLog As TextStream

In the Object Browser (F2), select "Scripting" in the list of
libraries. Then find "FileSystemObject" in the classes and finally
click on "CreateTextFile" in the Members section in the right-hand
side pane. At the bottom, you should see something like:
Function CreateTextFile(FileName As String, [Overwrite As Boolean =
True], [Unicode As Boolean = False]) As TextStream
Member of Scripting.FileSystemObject
Create a file as a TextStream

HTH
 
T

Tony Jollans

moog was obviously synthesised!

To find out types for objects from non-referenced libraries you can pause
the code after the object pointers have been set and, in the immediate
window enter, for example,

?Typename(mlog)

or you can add the same thing temporarily in your code - either

Msgbox typename(mlog)

or

debug.print typename(mlog)
 
J

Jonathan West

It's called Microsoft Scripting Runtime in the Tools References list.

--
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

Greg Maxey said:
JGM,

I don't have a "scripting" in the list of libaries :-(

Where do I find it?

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

Jean-Guy Marcil said:
Greg Maxey was telling us:
Greg Maxey nous racontait que :
What should fLog and moog be declared as in the snippet of code
below? Dim fFolderName As String, filename As String, oFolderPath As
String
Dim f As Object
Dim flog
Dim moog

Set f = CreateObject("Scripting.FileSystemObject")
fFolderName = Environ$("APPDATA") & "\~folders" & ".txt"
mFileName = Environ$("APPDATA") & "\~macros" & ".txt"
Set fLog = f.Createtextfile(fFolderName, True)
Set mLog = f.Createtextfile(mFileName, True)

Thanks

Dim fLog As TextStream
Dim mLog As TextStream

In the Object Browser (F2), select "Scripting" in the list of
libraries. Then find "FileSystemObject" in the classes and finally
click on "CreateTextFile" in the Members section in the right-hand
side pane. At the bottom, you should see something like:
Function CreateTextFile(FileName As String, [Overwrite As Boolean =
True], [Unicode As Boolean = False]) As TextStream
Member of Scripting.FileSystemObject
Create a file as a TextStream

HTH
 
G

Greg Maxey

Ok, thanks.

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

Jonathan said:
It's called Microsoft Scripting Runtime in the Tools References list.


Greg Maxey said:
JGM,

I don't have a "scripting" in the list of libaries :-(

Where do I find it?

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

Jean-Guy Marcil said:
Greg Maxey was telling us:
Greg Maxey nous racontait que :

What should fLog and moog be declared as in the snippet of code
below? Dim fFolderName As String, filename As String, oFolderPath
As String
Dim f As Object
Dim flog
Dim moog

Set f = CreateObject("Scripting.FileSystemObject")
fFolderName = Environ$("APPDATA") & "\~folders" & ".txt"
mFileName = Environ$("APPDATA") & "\~macros" & ".txt"
Set fLog = f.Createtextfile(fFolderName, True)
Set mLog = f.Createtextfile(mFileName, True)

Thanks

Dim fLog As TextStream
Dim mLog As TextStream

In the Object Browser (F2), select "Scripting" in the list of
libraries. Then find "FileSystemObject" in the classes and finally
click on "CreateTextFile" in the Members section in the right-hand
side pane. At the bottom, you should see something like:
Function CreateTextFile(FileName As String, [Overwrite As
Boolean = True], [Unicode As Boolean = False]) As TextStream
Member of Scripting.FileSystemObject
Create a file as a TextStream

HTH
 
J

Jean-Guy Marcil

Tony Jollans was telling us:
Tony Jollans nous racontait que :
moog was obviously synthesised!

To find out types for objects from non-referenced libraries you can
pause the code after the object pointers have been set and, in the
immediate window enter, for example,

But keep in mind that if it is non-referenced, then Declaring it as its
actual type will cause an error.
In other words, if you plan on declaring a variable as its actual type, then
you have to reference it, otherwise, just declare it as "Object".

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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