• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

Previewing in internet Expolrer

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
blabliblo
Asked:
blabliblo
  • 3
  • 2
1 Solution
 
SNilssonCommented:

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
 
blablibloAuthor Commented:
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
 
rinksno1Commented:
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
SNilssonCommented:

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
 
SNilssonCommented:

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
 
blablibloAuthor Commented:
thanks snilsson your comment is the accepted comment
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now