What is the code in Visual Basic 6 to Open a Word Document on a server without Word installed?

I am using VB 6 and coding an app requiring a Word document to be opened upon Button click.  In addition, I need to know how to have the following occur upon seperate button clicks:
1.  Start an executable
2.  Change a registry key
3.  Write to a log file
Who is Participating?
REMINDER: Normally you only ask 1 question (or 2 if they are related), but not 4 different questions at the same time !!!

1. To open a Word-document without word installed -> it will be openend in another program then ?
2. Start an executable
"Using the ShellExecute Function to Launch Applications in Visual Basic"
3. Registry:
If you include a reference to Windows Scripting in your project, you can write to the registry with just a couple of lines of code.

dim wshShell
Set wshShell = CreateObject("WScript.Shell")
strTemp = WshShell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\")

WshShell.RegWrite ("HKCU\\Software\\ACME\\FortuneTeller\\MindReader", "Goocher!", "REG_SZ");

Full docs are at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthregwrite.asp

4. write to a file
        If strFilename = "" Then strFilename = App.Path & "\hist.txt"
        fh = FreeFile
        Open strFilename For Append As fh
        Print #fh, Format(Now, "dd/mm/yyyy hh:nn:ss") & " - " & Environ("username") & " - " & strProcedure
        Close fh
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.