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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling Wins timedate.cpl not working

Status
Not open for further replies.

Trudye

Programmer
Sep 4, 2001
932
US
Ok, here's another example that doesn't seem to work and the details surrounding it in the book are sketchie. Thie function is suppose to open Windows TimeDate dialog box. The author sometimes omits declarations and details so I'm not sure why this is not working.

Thanks much,
Trudye

Sub ShowDateTimeCalendarDialog()
'This funciton displays the Date,Time,Calendar Dialog box that
'displays when you dbl click the status bar clock

Dim TaskID As Long
Arg = "rundl132.exe shell32.dll.control_Rundll timedate.cpl"
On Error Resume Next

TaskID = Shell(Arg)
If Err <> 0 Then
MsgBox "Cannot start app"
End If
End Sub

 
Hi again Trudye,

Try this one:

Code:
Sub ShowDateTimeCalendarDialog()
'This funciton displays the Date,Time,Calendar Dialog box that
'displays when you dbl click the status bar clock

   Set oShell = CreateObject("WScript.Shell")
oShell.Run "control timedate.cpl ,2", 1, True

   If Err <> 0 Then
      MsgBox "Cannot start app"
   End If
End Sub

Regards,

Peter

Remember- It's nice to be important,
but it's important to be nice :)
 
Thanks Pete for responding. I have a question, what should oshell be dim'd as? I know it should be an object just not sure what type of object.

Thanks again,
Trudye
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top