Solved

Previewing in internet Expolrer

Posted on 2004-08-13
6
164 Views
Last Modified: 2010-05-02
hi...
i'm creating something kind of NotePad in windows and i want to insert a function that if the user click on it, the program will show what he wrote in the explorer....can someone help me??
thanks! :)
0
Comment
Question by:blabliblo
  • 3
  • 2
6 Comments
 
LVL 8

Expert Comment

by:SNilsson
ID: 11791517

You can save your text as a temporary file say Temp.txt and then use the shell command to view it in explorer, something like this:

Dim lng as long
Dim sTempFile as string
Dim sExplorerPath as string
Dim sShellCommand as string

sTempFile = "C:\Temp.txt"
sExplorerPath = "C:\Program Files\Internet Explorer\iexplore.exe"
sShellCommand = sExplorerPath & " " & sTempFile

lng = Shell( sShellCommand , 1)
0
 

Author Comment

by:blabliblo
ID: 11791578
but here you need to have an existing file and i want that the file that is now open will be previewed....you know how to do it?
0
 
LVL 3

Expert Comment

by:rinksno1
ID: 11791656
for new file first save them (using scripting runtime) in windows temp folder and then view it using explorer...
for existing file....that is opened you have to first store the file full path into a variable ....and then open it ...
and don't use shell command (u never know where the iexplorer.exe is residing) use internet explorer object instead ....

'===============================
''''''
'global variable
dim filepath


Private sub cmdOpen_click()
'''''code for opening the file....


'filepath must be set to the open file......

''''

end sub

private sub cmdOpenfile)_click()
    Dim a
    Set a = CreateObject("InternetExplorer.Application")
    a.Visible = True
    a.Navigate2 (filepath)
end sub
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 8

Expert Comment

by:SNilsson
ID: 11791674

To view a file in the browser you will need an existing file, the thought from my side was that when the user want to do a preview, first same the content in the editor to a temporary text file, then display the text file in IE.

If you dont know how to save the content from your editor as a text file I can provide the code to do so.
0
 
LVL 8

Accepted Solution

by:
SNilsson earned 200 total points
ID: 11791735

There try this sub below you can call it like this:

Call Preview(Myeditor.Text)


Public Sub Preview(sMytext as string)

Dim lng as long
Dim sTempFile as string
Dim sExplorerPath as string
Dim sShellCommand as string

sTempFile = "C:\Temp.txt"
sExplorerPath = "C:\Program Files\Internet Explorer\iexplore.exe"
sShellCommand = sExplorerPath & " " & sTempFile

Open sTempFile  for output as #1
    Print #1, sMytext
Close 1

lng = Shell( sShellCommand , 1)

End Sub



0
 

Author Comment

by:blabliblo
ID: 11792228
thanks snilsson your comment is the accepted comment
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

778 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