Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 6th, 2012  |  syntax: None  |  size: 0.80 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. VB6 Shell Function - Invalid procedure call or argument shell
  2. Sub OpenTextFile(textfile$)
  3.   Dim txtapp$, arg$
  4.   txtapp = "Notepad.exe"
  5.   textfile = "C:UsersADMINDesktopUSA - FLNGmodeloutSUMMER.CFS"
  6.   arg = Trim$(txtapp & " " & Chr$(34) & Trim$(textfile) & Chr$(34))
  7.   ierr = Shell(arg, vbNormalFocus)
  8. End Sub
  9.        
  10. Sub OpenTextFile(textfile As String)
  11.  
  12. Const txtapp As String = "Notepad.exe"
  13. Dim arg As String
  14. Dim ierr As Double
  15.  
  16.   arg = Trim$(txtapp & " " & Chr$(34) & Trim$(textfile) & Chr$(34))
  17.   ierr = Shell#(arg, vbNormalFocus)
  18.  
  19. End Sub
  20.        
  21. Sub OpenTextFile(textfile As String)
  22. Dim oShell As Object
  23.  
  24.   Set oShell = GetShell
  25.  
  26.   If Not oShell Is Nothing Then
  27.     oShell.Run textfile
  28.   End If
  29. End Sub
  30.  
  31. Function GetShell() As Object
  32.   On Error Resume Next  
  33.   Set GetShell = CreateObject("WScript.Shell")
  34. End Function