Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. controlling other applications from VB.NET

controlling other applications from VB.NET

Scheduled Pinned Locked Moved Visual Basic
tutorialquestioncsharphelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mrmathews99
    wrote on last edited by
    #1

    Hi, I am trying to create a window application to control another application. At the moment I can only find info on how to open applications such as note pad and send strings to write in note pad. Let's say if I would like to do other things apart from just sending a string to notepad, how would I do it. For example if I want to run a specific program such as MS Word, and then I want to access one of the menus to perform a certain action such as changing fonts or input shape into the Word document. I would like to perform all this using the controls such as a button on a form in VB.NET, how can I do this? Any help would be greatly appreciated.

    H 1 Reply Last reply
    0
    • M mrmathews99

      Hi, I am trying to create a window application to control another application. At the moment I can only find info on how to open applications such as note pad and send strings to write in note pad. Let's say if I would like to do other things apart from just sending a string to notepad, how would I do it. For example if I want to run a specific program such as MS Word, and then I want to access one of the menus to perform a certain action such as changing fonts or input shape into the Word document. I would like to perform all this using the controls such as a button on a form in VB.NET, how can I do this? Any help would be greatly appreciated.

      H Offline
      H Offline
      hannesHTG
      wrote on last edited by
      #2

      Hello mrmathesw99! Well there is a couple of things to note here: To start various applications, you could use Process.Start. I have noticed however, that you mention you want to able to do many things with MS Word for example. In that case you could use Automation to do whatever you want with Word, Excel etc. So, what you need to do is to add a Reference To the Microsoft Word Object Library (Just click References in the Solution Explorer, and say Add Reference, Select the COM tab, and scroll until you find it) You can add references to all MS Office programs like that. Once that is done, you can create Word Apllication variables and manipulate Word through that. Amazing huh ¿ Here's a small sample : Dim SSWord As New Word.Application 'word application Dim SSWordDoc As Word.Document 'document object SSWord = DirectCast(GetObject(, "Word.Application"), Word.Application) SSWordDoc = SSWord.Documents.Add(, , 1, False) 'add a document SSWord.WindowState = SSWord.WindowState.wdWindowStateMaximize 'maximise word window SSWord.Activate() 'activate it SSWord.ActiveWindow.ActivePane.View.ShowAll = True 'show / hide symbols = true After using the Word objects, you need to set the Word Objects to Nothing And Quit it as well Hope it helps! H T G

      M 1 Reply Last reply
      0
      • H hannesHTG

        Hello mrmathesw99! Well there is a couple of things to note here: To start various applications, you could use Process.Start. I have noticed however, that you mention you want to able to do many things with MS Word for example. In that case you could use Automation to do whatever you want with Word, Excel etc. So, what you need to do is to add a Reference To the Microsoft Word Object Library (Just click References in the Solution Explorer, and say Add Reference, Select the COM tab, and scroll until you find it) You can add references to all MS Office programs like that. Once that is done, you can create Word Apllication variables and manipulate Word through that. Amazing huh ¿ Here's a small sample : Dim SSWord As New Word.Application 'word application Dim SSWordDoc As Word.Document 'document object SSWord = DirectCast(GetObject(, "Word.Application"), Word.Application) SSWordDoc = SSWord.Documents.Add(, , 1, False) 'add a document SSWord.WindowState = SSWord.WindowState.wdWindowStateMaximize 'maximise word window SSWord.Activate() 'activate it SSWord.ActiveWindow.ActivePane.View.ShowAll = True 'show / hide symbols = true After using the Word objects, you need to set the Word Objects to Nothing And Quit it as well Hope it helps! H T G

        M Offline
        M Offline
        mrmathews99
        wrote on last edited by
        #3

        Thanks HTG... I will give this a try with the application I'm trying to run and will see how it goes.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups