Solved

Previewing in internet Expolrer

Posted on 2004-08-13
6
166 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
[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
  • 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
Technology Partners: 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!

 
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB6 Compile Compatibility Issue 4 123
VB6 - Convert HH:MM into Decimal 8 70
VBA: copy range dynamically based on config sheet v2 3 55
Macro problems with Excel file 6 28
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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…

697 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