473,322 Members | 1,778 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,322 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 1063
* "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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.