Home > Net >  Vb.net to start the word
Vb.net to start the word

Time:09-17

Design a few buttons, each button when you click start a specified program
How to start a blank Word document, InternetExplor, drawing and so on

CodePudding user response:

With shell and then directly with the program path
Shell (Application. StartupPath & amp; "\ ABC exe," vbNormalFocus)

CodePudding user response:

If you need to run the exe directory in the PATH environment variable, or your own program in the same directory, can directly use the name of exe to start
Process. The Start (" mspaint. Exe ")
Process. The Start (" notepad. Exe ")

Otherwise, use the full path to start
Process. The Start (" C: \ Program Files \ Microsoft Office \ Office16 \ excel exe ")

CodePudding user response:

Shell (" C: \ Program Files \ Internet Explorer \ iexplore (x86) exe http://www.baidu.com ", Wait:=True)
Dim tp As String=My. Application. Info. DirectoryPath & amp; "\ test. The text"
IO. File. WriteAllBytes (tp, {51} 48, 49,)
Process. The Start (notepad. Exe, tp)

CodePudding user response:

Shell (" winword. Exe ")

CodePudding user response:

refer to the second floor X - I - n reply:
if you need to run the exe directory in the PATH environment variable, or your own program in the same directory, you can directly use the name of exe to start
Process. The Start (" mspaint. Exe ")
Process. The Start (" notepad. Exe ")

Otherwise, use the full path to start
Process. The Start (" C: \ Program Files \ Microsoft Office \ Office16 \ excel exe ")

Positive solution!

CodePudding user response:

The import Windows. Office. Interop

Dim oWordApp as word. Application
Dim oWordDoc as word. The document

Privat sub button_click (... )...

OWordApp=new word. Application
OWordDoc=oWordApp. Add ([readonly] :=false, visible=true)
OWordApp. Visible=true

End sub

CodePudding user response:

refer to 6th floor kshengster response:
import Windows. Office. Interop

Dim oWordApp as word. Application
Dim oWordDoc as word. The document

Privat sub button_click (... )...

OWordApp=new word. Application
OWordDoc=oWordApp. Add ([readonly] :=false, visible=true)
OWordApp. Visible=true

End sub

In this office proposal

CodePudding user response:

1. Open the word
Reference: Microsoft word 12.0 object library
Dim wordobj. As Microsoft office. Interop. Word. Application
Dim word. As Microsoft office. Interop. Word. The document
Wordobj=new Microsoft. Office. Interop. Word. Application
Word=wordobj. Document. The add
Wordobj. Visible=true

2. Open the ie
Dim as object ie=createobject (" InternetExplorer. Application ")
Dim url as string="www.baidu.com"
Ie. Visible=true
Ie. Navigate (url)

3. Open the drawing
Shell (" c: \ Windows \ system32 \ mspaint exe ", appwinstyle. Normalfocus)
  • Related