Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

a tricky one (spiced up with getObject)

Status
Not open for further replies.

uladzik

Programmer
Feb 12, 2001
55
BY
I have a VBS script on my local machine. I'd like to call a DUN (Dial Up Network connection) file from that script.

I've tried the following method:
Code:
Set dun = GetObject("c:\windows\desktop\nextra.dun")
but it doesn't work. Any suggestions? I'd be very thankful.

Just to give you some more background information:

1) If you want to try it yourself but you don't have a DUN file, just go to "My Computer", click on "Dial-Up Networking" and choose "Make new connection". Then cut&paste the file (not the shortcut) to the desktop. So you'll get a file with DUN extension on your desktop. If you double-click the icon, the "Connect To" dialogbox is launched. That's what I need to launch from my VBS.

2) I also tried to find the associated program by searching the file types, and it turned out that DUN files are handled by Rundll32.exe. Thus, I've tried to run a command line "rundll32 c:\windows\desktop\nextra.dun" but it didn't work either.

Looking forward to any help!
Thanks in advance,
Uladzik
---
---
 
Set dun = GetObject("c:\windows\desktop\nextra.dun")
at this point an object of type "nextra.dun" does not exist.
Use
Set dun = CreateObject("c:\windows\desktop\nextra.dun")
 
Tim,
I don't think this will solve the problem.
CreateObject has the following syntax:
CreateObject(servername.typename)
e.g.
Set ExcelSheet = CreateObject("Excel.Sheet")
And it will not work in this case because rundll32 is not an Automation object.

Uladzik, I really don't know how to solve this one.
---
---
 
I don't know anything about DUN files. I tried to create one, but I found it impossible to paste the original Connection file into my desktop.

So I cannot try this piece of code. Please try and let my know if it works. Also, if you have an idea about why I cannot create a DUN file, please let me know


set wshshell = CreateObject ("Wscript.Shell")
wshshell.run "c:\windows\desktop\nextra.dun"
 
Finally I managed to create a DUN file with "drag & drop". So I tried these two commands and they worked

<b>set wshshell = CreateObject (&quot;Wscript.Shell&quot;)
wshshell.run &quot;c:\windows\desktop\nextra.dun&quot;</b>

 
flyax63

I want to thank you because of your example
i found a solution to my problem, that was to open
any file from my code.

Thanks very much
GNIKOL


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top