Results 1 to 8 of 8

Thread: [RESOLVED] Opening txt file with notepad

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2006
    Posts
    98

    Resolved [RESOLVED] Opening txt file with notepad

    Okay i have a combo box (categories), a textbox (AddNewCategory)
    and a button (add2)
    The user types in a file name then clicks the button Add2 then that goes to the categories(combobox). Then i want it to be opened in notepad right after its been clicked ( feel free to take the sleep out) I use this code below to do it except when opening Notepad it wont work.

    Code:
    Private Sub Add2_Click()
    Dim fso As New FileSystemObject
    Dim Apath As String
    Dim Spath As String
        Apath = App.Path
        
        Categories.AddItem (AddNewCategory.Text)
        
        fso.CreateTextFile (AddNewCategory.Text & ".txt")
        Spath = Apath & "\" & AddNewCategory.Text & ".txt"
        Sleep 1000
    
    Shell "Notepad" Spath, vbNormalFocus
        
    End Sub
    please help!
    thanks in advance

  2. #2

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2006
    Posts
    98

    Re: Opening txt file with notepad

    That didnt work. Spath is correct. "End of statement" is the error.

  4. #4

  5. #5
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: Opening txt file with notepad

    Rhino you forgot an &


  6. #6

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jun 2006
    Posts
    98

    Re: Opening txt file with notepad

    Weird, i tried that early and it didn't work... but now it does. i gues Spath was incorrect the first time i tried. Thanks!

  8. #8

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width