Solved

Previewing in internet Expolrer

Posted on 2004-08-13
6
162 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now