?
Solved

Sending a txt file to another program

Posted on 1998-08-13
3
Medium Priority
?
168 Views
Last Modified: 2010-04-30
If i have a text box with html code in it how could i go about useing a command button to post that text to the registered html viewer for the system so that i could view the rendered output for the html.
0
Comment
Question by:hess
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 8

Expert Comment

by:Answers2000
ID: 1468763
Write the text in to a file with extension .HTM or .HTML then simply run the file.  You can do this using the ShellExecute API
0
 

Author Comment

by:hess
ID: 1468764
Sorry to reject your answer but i don't know how to use the shell api so if you could write some code for me the points are yours.
0
 

Accepted Solution

by:
dokken earned 120 total points
ID: 1468765
This works...

Create a module and put this in it(all on one line):

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

Add this to your form code and modify it as needed:

Private Sub command1_Click()

       Open "temp.htm" For Output As #1
       Print #1, Text1.Text
       Close #1
       iRet = ShellExecute(Me.hwnd, vbNullString, "file://temp.htm", vbNullString, "c:\", SW_SHOWNORMAL)
       Exit Sub

End Sub

thats all there is to it.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month12 days, 2 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question