Excel VBA

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • risk32
    New Member
    • Mar 2008
    • 98

    Excel VBA

    I seem to be having a "brain fart" with the Shell() command for Visual Basic.
    Either that, or what I'm trying to can't be done and I'm just a noob for trying.

    Anyways, here's what I'm trying to do:
    Private Sub cmdLink_Click()
    Shell ("C:\Program Files\Microsoft Office\OFFICE11 \POWERPNT.EXE" "lblLink4.capti on")
    End Sub

    Here's an example of what lblLink4.captio n could read:
    "\\yofs13\374og \03_36AS_DUTY_D ESK\Temp Duty Desk Web Page Files\AIRFIELD\ JANUARY\01\01_J AN.ppt"

    All I need to do is use the caption from lblLink4 as a path for the shell command. Unfortunately, I'm fairly new to VB (only 2 yrs. exp) and have no idea if this is even possible. Any help on this qould be greatly appreciated.
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    I Guess, you need to wrap the Location with a Double Quote in Shell....
    Try this :

    [code=vb]
    Shell ("C:\Program Files\Microsoft Office\OFFICE11 \POWERPNT.EXE " & Chr(34) & lblLink4.captio n & Chr(34) )
    [/code]

    Regards
    Veena

    Comment

    • risk32
      New Member
      • Mar 2008
      • 98

      #3
      Originally posted by QVeen72
      Hi,

      I Guess, you need to wrap the Location with a Double Quote in Shell....
      Try this :

      [code=vb]
      Shell ("C:\Program Files\Microsoft Office\OFFICE11 \POWERPNT.EXE " & Chr(34) & lblLink4.captio n & Chr(34) )
      [/code]

      Regards
      Veena
      Thanks for the help Veena, it worked just fine.

      Comment

      Working...