473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Opening a document

Hi

How can I make vb.net open a document in its respective app; word, excel
etc. from a documents name and path? e.g. c:\...\mydoc.doc should
automatically open in word.

Thanks

Regards

Nov 20 '05 #1
13 1065
* "John" <jo**@nospam.infovis.co.uk> scripsit:
How can I make vb.net open a document in its respective app; word, excel
etc. from a documents name and path? e.g. c:\...\mydoc.doc should
automatically open in word.


\\\
Dim p As New System.Diagnostics.ProcessStartInfo()
p.Verb = "print"
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\filename.doc"
p.UseShellExecute = True
System.Diagnostics.Process.Start(p)
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
* "John" <jo**@nospam.infovis.co.uk> scripsit:
How can I make vb.net open a document in its respective app; word, excel
etc. from a documents name and path? e.g. c:\...\mydoc.doc should
automatically open in word.


\\\
Dim p As New System.Diagnostics.ProcessStartInfo()
p.Verb = "print"
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\filename.doc"
p.UseShellExecute = True
System.Diagnostics.Process.Start(p)
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
Thanks. Do I need to do any cleanup afterwards too, like close the process
etc.?

Regards

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:O9**************@TK2MSFTNGP10.phx.gbl...
* "John" <jo**@nospam.infovis.co.uk> scripsit:
How can I make vb.net open a document in its respective app; word, excel
etc. from a documents name and path? e.g. c:\...\mydoc.doc should
automatically open in word.


\\\
Dim p As New System.Diagnostics.ProcessStartInfo()
p.Verb = "print"
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\filename.doc"
p.UseShellExecute = True
System.Diagnostics.Process.Start(p)
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #4
Thanks. Do I need to do any cleanup afterwards too, like close the process
etc.?

Regards

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:O9**************@TK2MSFTNGP10.phx.gbl...
* "John" <jo**@nospam.infovis.co.uk> scripsit:
How can I make vb.net open a document in its respective app; word, excel
etc. from a documents name and path? e.g. c:\...\mydoc.doc should
automatically open in word.


\\\
Dim p As New System.Diagnostics.ProcessStartInfo()
p.Verb = "print"
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\filename.doc"
p.UseShellExecute = True
System.Diagnostics.Process.Start(p)
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #5
* "John" <jo**@nospam.infovis.co.uk> scripsit:
Thanks. Do I need to do any cleanup afterwards too, like close the process
etc.?


No.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #6
* "John" <jo**@nospam.infovis.co.uk> scripsit:
Thanks. Do I need to do any cleanup afterwards too, like close the process
etc.?


No.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #7
OK, it works fine for doc, html etc. But I am having problem with pdf and
mpg. I am using blank verb and providing full filename with extension.

p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\MyPDF.pdf"

In case of pdf I get the adobe acrobat splash but no document appears once
acrobat is loaded. In mpg, windows player does not appear but the audio
starts to play. If I run the code again them the application (acrobat or
windows player) appears.

What am I missing?

Thanks

Regards
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ur**************@TK2MSFTNGP10.phx.gbl...
* "John" <jo**@nospam.infovis.co.uk> scripsit:
Thanks. Do I need to do any cleanup afterwards too, like close the process etc.?


No.

--
Herfried K. Wagner [MVP]
http://www.mvps.org/dotnet

Nov 20 '05 #8
OK, it works fine for doc, html etc. But I am having problem with pdf and
mpg. I am using blank verb and providing full filename with extension.

p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\MyPDF.pdf"

In case of pdf I get the adobe acrobat splash but no document appears once
acrobat is loaded. In mpg, windows player does not appear but the audio
starts to play. If I run the code again them the application (acrobat or
windows player) appears.

What am I missing?

Thanks

Regards
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ur**************@TK2MSFTNGP10.phx.gbl...
* "John" <jo**@nospam.infovis.co.uk> scripsit:
Thanks. Do I need to do any cleanup afterwards too, like close the process etc.?


No.

--
Herfried K. Wagner [MVP]
http://www.mvps.org/dotnet

Nov 20 '05 #9
* "John" <jo**@nospam.infovis.co.uk> scripsit:
OK, it works fine for doc, html etc. But I am having problem with pdf and
mpg. I am using blank verb and providing full filename with extension.

p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\MyPDF.pdf"

In case of pdf I get the adobe acrobat splash but no document appears once
acrobat is loaded. In mpg, windows player does not appear but the audio
starts to play. If I run the code again them the application (acrobat or
windows player) appears.


Do you want the application to appear?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #10
I just like it to work like when a file is double clicked in windows
explorer. Most of the time the application appears. It is important for
acrobat to appear to read the document. Also windows player is needed when
mpg is a video.

Regards

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OU**************@TK2MSFTNGP10.phx.gbl...
* "John" <jo**@nospam.infovis.co.uk> scripsit:
OK, it works fine for doc, html etc. But I am having problem with pdf and mpg. I am using blank verb and providing full filename with extension.

p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\MyPDF.pdf"

In case of pdf I get the adobe acrobat splash but no document appears once acrobat is loaded. In mpg, windows player does not appear but the audio
starts to play. If I run the code again them the application (acrobat or
windows player) appears.


Do you want the application to appear?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #11
* "John" <jo**@nospam.infovis.co.uk> scripsit:
I just like it to work like when a file is double clicked in windows
explorer. Most of the time the application appears. It is important for
acrobat to appear to read the document. Also windows player is needed when
mpg is a video.


Why do you set 'WindowStyle' to 'Hidden'?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #12
Sorry, it was in your original code and I left it like that., So, is that I
need to change?

Regards

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:e0**************@TK2MSFTNGP09.phx.gbl...
* "John" <jo**@nospam.infovis.co.uk> scripsit:
I just like it to work like when a file is double clicked in windows
explorer. Most of the time the application appears. It is important for
acrobat to appear to read the document. Also windows player is needed when mpg is a video.


Why do you set 'WindowStyle' to 'Hidden'?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #13
* "John" <jo**@nospam.infovis.co.uk> scripsit:
Sorry, it was in your original code and I left it like that., So, is that I
need to change?


Yes, remove the line. I feel sorry for not removing it in the original
post.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jawahar Rajan | last post by:
All, I have a printer friendly page that is opened when a user clicks a link on my page to get the printer friendly version, How ever when they close out the printer friendly version and return to...
3
by: Display Name | last post by:
When this form's being submitted, two windows are opening instead of only one here is the function I'm using: function subForm(){ //insert form validation here //if form is valid, open a...
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
3
by: Andy Davis | last post by:
I have set up a mail merge document in Word 2003 which gets its data from my Access 2000 database. I want to set up a button on a form that: 1. runs the query to provide the dat for the merge...
2
by: Colin Halliday | last post by:
I have a Word 2003 mail merge main document (form letter) that is linked to another Word document data source for the mail merge. If I open this doc using the Word GUI, it first asks me to...
5
by: Cedric | last post by:
Hi Folks, I'm wondering if someone has already succeed to open a word2000 document located on server side with javascript code executed by a web browser on client side. In fact, i make it...
0
by: =?Utf-8?B?V2FubmFiZQ==?= | last post by:
I am creating a webpage and opening it as a Word document. Problem is that as I create one of the questions, some of the text is not appearing in the document as it should. As I step through it, I...
0
by: aarthiraaj | last post by:
In my user screen I have view link, if I click this link it will go to servlet and open one word document. It is opening properly, but while opening the attachment it generate one dialog box like...
1
by: abhishekbrave | last post by:
The code below is opening a calendar on mouse over in the same window. I need the calendar to be opened in new window. Have to fulfill this requirement urgentely so posting the whole code here. I...
2
by: rlu | last post by:
Is there a way to print a pdf document without opening it, if user just select the pdf files in the checkbox and click a button? I tried the following two methods, but both fail. 1. open a new...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.