how can i open files in my computer using command button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sirimanna
    New Member
    • Apr 2007
    • 21

    how can i open files in my computer using command button

    hi,
    Is any one can help me to open files in my computer(for an example: some word document)using command button... i want to open file's using my vb programme..but i can't do it...can any one help me? for an example there is a "open" button in every programme...i want cord for "open" bitton
    thanks..
  • iburyak
    Recognized Expert Top Contributor
    • Nov 2006
    • 1016

    #2
    Go to projecct - components
    Check

    [PHP]Microsoft Common Dialog Control, Version 6.0[/PHP]

    Modify code below as you wish.

    [PHP]Dim sFileName As String, NextLine As String

    Dim FH As Long



    With CommonDialog1

    .CancelError = True

    .Filter = "All Files(*.*)|*.*| Text Files(*.txt)|*. txt"

    .FilterIndex = 2

    .InitDir = "I use this property when I have default directory standard or in many cases I save last used path"

    .ShowOpen



    sFileName = .FileName

    End With



    FH = FreeFile()



    Open sFileName For Input Access Read Shared As #FH



    Do Until EOF(FH)

    Line Input #FH, NextLine

    Text1.Text = Text1.Text & vbCrLf

    Loop



    Close #FH [/PHP]

    Good Luck.

    Comment

    • sirimanna
      New Member
      • Apr 2007
      • 21

      #3
      thank u very much my friend...thank u very much

      Comment

      • iburyak
        Recognized Expert Top Contributor
        • Nov 2006
        • 1016

        #4
        Did it work?

        Comment

        • sirimanna
          New Member
          • Apr 2007
          • 21

          #5
          thank's it's work...thank u friend

          Comment

          Working...