DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2005
    Location
    Romania
    Posts
    23

    Open a notepad file

    Hi,

    Could you help me? I want to open a notepad file, after I put some dates into it.
    My code is that:
    ==========================
    Sub Fill_list()
    Dim w As Integer
    Dim strClients As String
    Open App.Path & "/Address email.txt" For Output As #2
    For w = 0 To lstEmail.ListCount - 1 Step 1
    strClients = lstEmail.List(w) & ";"
    Print #2, strClients
    Next w
    Print #2, "==================================================="
    Print #2, "Total number of address=", (lstEmail.ListCount - 1)
    Close #2
    MsgBox "The addresses was written in " & App.Path & "/Address email.txt", vbInformation,"Email CONTACT"
    Here,after msgbox was closed, I want to open the notepad file
    End Sub
    ====================================
    If you have some time for help me, please do it...It's a emergency for me.


    Thanks in advance and,
    Best regards
    Zane
    zane

  2. #2
    Join Date
    Feb 2004
    Location
    Colton, CA
    Posts
    550
    I'm just looking for the code - it's the SHELL command you need to use.

  3. #3
    Join Date
    Feb 2004
    Location
    Colton, CA
    Posts
    550
    Okay, to open notepad you need to know the path of the application. It's most likely to be c:\windows\notepad BUT this MAY change.

    So, this code will get you going:

    Code:
    a = Shell("c:\windows\notepad.exe", vbNormalFocus)
    Debug.Print a
    The a becomes the thread ID.

  4. #4
    Join Date
    Feb 2004
    Location
    Colton, CA
    Posts
    550
    As for parsing the file, someone else will know the answer to that one.

  5. #5
    Join Date
    Dec 2003
    Posts
    2,750
    Quote Originally Posted by z.s
    Hi,

    Could you help me? I want to open a notepad file, after I put some dates into it.
    Use the ShellExecute API function call:

    http://vbnet.mvps.org/code/shell/shellexecute.htm
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

  6. #6
    Join Date
    Oct 2004
    Posts
    57

    Other Solution

    Also another way to do this without an API call is to do:
    Code:
    Shell "Notepad.exe NameOfFileHere", VbNormalFocus
    example:
    Code:
    Shell "Notepad.exe C:\Program Files\Test.txt", VbNormalFocus
    Hope that helps
    Last edited by salvinger; 05-04-2005 at 07:26 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links