Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / May 2007

Tip: Looking for answers? Try searching our database.

WSHNetwork

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mcnewsxp - 17 May 2007 20:06 GMT
what reference do i need to check to make this work?
Dim WSH As New WSHNetwork
Douglas J. Steele - 17 May 2007 21:49 GMT
Windows Script Host Object Model.

But why do you want it? What are you trying to do? There may be better ways.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

> what reference do i need to check to make this work?
> Dim WSH As New WSHNetwork
mcnewsxp - 17 May 2007 22:16 GMT
> Windows Script Host Object Model.
>
> But why do you want it? What are you trying to do? There may be better
> ways.

not sure.
it's another one of those inherited systems.
i get an error message when i try to complie the code is the only reason.
i'm on a budget and deadline so i don't have time to fish around.
David W. Fenton - 18 May 2007 21:46 GMT
>> Windows Script Host Object Model.
>>
[quoted text clipped - 6 lines]
> reason. i'm on a budget and deadline so i don't have time to fish
> around.

You can almost always replace a reference (early binding) with late
binding and use Object variable types. Here's an example:

 Dim objFSO As Object

 Set objFSO = CreateObject("Scripting.FileSystemObject")

 If objFSO.FolderExists("\\d9m09521\WB\") Then

 [etc.]

In that case, I'm able to use the .FolderExists method of the File
System Object without needing to have a reference to it.

Signature

David W. Fenton                  http://www.dfenton.com/
usenet at dfenton dot com    http://www.dfenton.com/DFA/

Douglas J. Steele - 19 May 2007 12:04 GMT
>>> Windows Script Host Object Model.
>>>
[quoted text clipped - 20 lines]
> In that case, I'm able to use the .FolderExists method of the File
> System Object without needing to have a reference to it.

Do you happen to know how to late bind WSH David? You need to add a
reference to Windows Script Host Object Model
(C:\Windows\System32\wshom.ocx). That shows up in the Object Browser as
IWshRuntimeLibrary

I would have expected that would result in

Set wshObj = CreateObject("IWshRuntimeLibrary.WSHNetwork")

working, but it doesn't.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

RoyVidar - 19 May 2007 13:04 GMT
"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in
message <uP3f9VgmHHA.3872@TK2MSFTNGP04.phx.gbl>:

>>>> Windows Script Host Object Model.
>>>>
[quoted text clipped - 31 lines]
>
> working, but it doesn't.

Try through WScript

Set wshObj = CreateObject("WScript.Network")

Signature

Roy-Vidar

Douglas J. Steele - 19 May 2007 15:28 GMT
> "Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in
> message <uP3f9VgmHHA.3872@TK2MSFTNGP04.phx.gbl>:
[quoted text clipped - 13 lines]
>
> Set wshObj = CreateObject("WScript.Network")

Thanks, Roy. That works.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

David W. Fenton - 19 May 2007 20:43 GMT
[]

>> You can almost always replace a reference (early binding) with
>> late binding and use Object variable types. Here's an example:
[quoted text clipped - 11 lines]
>
> Do you happen to know how to late bind WSH David?

I assume you've determined that the object I used above does not
represent the whole WSH object model?

> You need to add a
> reference to Windows Script Host Object Model
[quoted text clipped - 6 lines]
>
> working, but it doesn't.

I don't recall where I got the correct reference for using the FSO
with late binding.

Given that the wshom.ocx has the FileSystemObject as one of its
members, I'd think that it's the same thing. But an OCX is intended
to be used as a replacement for doing it directly. My guess would be
that this OCX is just an interface to the same functionality as I'm
getting through the Scripting object. Yes, just browsing the
registry I see that Scripting refers to the scripting functionality
in scrrun.dll. The OCX is a superset of scrrun.dl functionality, but
most of the additional functionality seems to me to be just
additions to make it easier to do things that scrrun.dll does.

OK, I'm wrong in what I say above. The libaries have a lot of
overlap, but are not the same. The OCX has these members:

 Drive, Drives, File, Files, FSO, Folder, Folders, TextStream,
 WSHCollection, WSHEnvironment, WSHExec, WSHNetwork, WSHShell,
 SWHShortcut, SWHURLShortcut

while the DLL adds Dictionary and Encoder, but lacks all the WSH
members.

However, the WSH members all seem to me to be for controlling the
WSH, rather than for implementing functionality offered by the WSH's
object model. That is, the WSH members are for getting to
functionality that doesn't have its own top-level object. I don't
know enough about the WSH to know what those would be.

Signature

David W. Fenton                  http://www.dfenton.com/
usenet at dfenton dot com    http://www.dfenton.com/DFA/

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.