?
Solved

Previewing in internet Expolrer

Posted on 2004-08-13
6
Medium Priority
?
170 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
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!

 
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 800 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month11 days, 19 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