Results 1 to 5 of 5

Thread: Open existing file from VB

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    4

    Question

    Hi,

    Could someone please show me how to open an existing file from VB.

    Thanks In Advance!

    ~Mark

  2. #2
    Guest
    Do you mean put text in your program?

    Code:
    Open "C:\file.txt" For Input As #1 
    Text1.Text = Input$(LOF(1), 1) 
    Close #1
    Or do you mean open an exe file?

    Code:
    Shell "C:\file.exe", VbNormalFocus

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    4

    THANKS

    .exe - I appreciate your help!

  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    4

    Question any file using windows associations

    Matthew,

    I need to open any file (i.e. .htm, .doc, etc). If the OLE contol worked properly, that would be perfect...

    Thanks,
    Mark

  5. #5
    Guest
    To open any file, use the ShellExecute function.

    Code:
    Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    Public Const SW_SHOWNORMAL = 1
    
    ShellExecute Me.hwnd, vbNullString, "C:\file.htm", vbNullString, "c:\", SW_SHOWNORMAL

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