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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. create a custom button in microsott word

create a custom button in microsott word

Scheduled Pinned Locked Moved ASP.NET
helpquestion
6 Posts 3 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
    member27
    wrote on last edited by
    #1

    Hi all, I want to create a custom button in menu of microsdoft word..can any one help me ?? i have wrote the code to open a word and just to create a button but i want the custom button in menu of the word document Dim oWord As Word.Application Dim oDoc As New Word.Document 'Dim oTable As Word.Table Dim oPara1 As Word.Paragraph Dim menu As Word.CustomLabel Dim oPara2 As Word.Paragraph Dim sCode As String Dim shp As Word.InlineShape Try 'Start Word and open the document template. oWord = CreateObject("Word.Application") oWord.Visible = True oDoc = oWord.Documents.Add oPara1 = oDoc.Content.Paragraphs.Add oDoc.Windows.Add("dd") oPara1.Range.Text = " Test Document" oPara1.Range.Font.Bold = True oPara1.Range.InsertParagraphAfter() oPara2 = oDoc.Content.Paragraphs.Add ''''''''Button Code shp = oDoc.Content.InlineShapes.AddOLEControl(ClassType:="Forms.CommandButton.1") shp.OLEFormat.Object.Caption = "Click Here" 'shp.OLEFormat.DisplayAsIcon = True sCode = "Private Sub " & shp.OLEFormat.Object.Name & "_Click()" & vbCrLf & _ " MsgBox ""You Clicked the CommandButton""" & vbCrLf & _ "End Sub" 'oWord.VBE.VBProjects().VBE.ActiveVBProject.CodeModule.AddFromString(sCode) oWord.VBE.VBProjects.VBComponents("ThisDocument").CodeModule.AddFromString(sCode) shp.OLEFormat.Object.Caption = "Click Here"

    C 1 Reply Last reply
    0
    • M member27

      Hi all, I want to create a custom button in menu of microsdoft word..can any one help me ?? i have wrote the code to open a word and just to create a button but i want the custom button in menu of the word document Dim oWord As Word.Application Dim oDoc As New Word.Document 'Dim oTable As Word.Table Dim oPara1 As Word.Paragraph Dim menu As Word.CustomLabel Dim oPara2 As Word.Paragraph Dim sCode As String Dim shp As Word.InlineShape Try 'Start Word and open the document template. oWord = CreateObject("Word.Application") oWord.Visible = True oDoc = oWord.Documents.Add oPara1 = oDoc.Content.Paragraphs.Add oDoc.Windows.Add("dd") oPara1.Range.Text = " Test Document" oPara1.Range.Font.Bold = True oPara1.Range.InsertParagraphAfter() oPara2 = oDoc.Content.Paragraphs.Add ''''''''Button Code shp = oDoc.Content.InlineShapes.AddOLEControl(ClassType:="Forms.CommandButton.1") shp.OLEFormat.Object.Caption = "Click Here" 'shp.OLEFormat.DisplayAsIcon = True sCode = "Private Sub " & shp.OLEFormat.Object.Name & "_Click()" & vbCrLf & _ " MsgBox ""You Clicked the CommandButton""" & vbCrLf & _ "End Sub" 'oWord.VBE.VBProjects().VBE.ActiveVBProject.CodeModule.AddFromString(sCode) oWord.VBE.VBProjects.VBComponents("ThisDocument").CodeModule.AddFromString(sCode) shp.OLEFormat.Object.Caption = "Click Here"

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Gee - aren't you the moron ? What does this have to do with .NET at all, let alone ASP.NET ?

      Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

      M 1 Reply Last reply
      0
      • C Christian Graus

        Gee - aren't you the moron ? What does this have to do with .NET at all, let alone ASP.NET ?

        Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

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

        I CANT UNDSTAND WAT U TRYING TO TELL.. yES I WANT TO CODE IN ASP.NET TO BRING THE BUTTON IN WORD TATS WAY I POSTED IN ASP.NET MESSAGE BOARDS

        A 1 Reply Last reply
        0
        • M member27

          I CANT UNDSTAND WAT U TRYING TO TELL.. yES I WANT TO CODE IN ASP.NET TO BRING THE BUTTON IN WORD TATS WAY I POSTED IN ASP.NET MESSAGE BOARDS

          A Offline
          A Offline
          Ashfield
          wrote on last edited by
          #4

          1. Turn CAPS LOCK off 2. Try being clearer in yopur question. All you talked about was adding a button in Word, Word is NOT ASP.NET 3. You cannot do this in asp.net, things like this are simply not allowed as they leave the system wide open for viruses.

          Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

          M 1 Reply Last reply
          0
          • A Ashfield

            1. Turn CAPS LOCK off 2. Try being clearer in yopur question. All you talked about was adding a button in Word, Word is NOT ASP.NET 3. You cannot do this in asp.net, things like this are simply not allowed as they leave the system wide open for viruses.

            Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

            M Offline
            M Offline
            member27
            wrote on last edited by
            #5

            Caps lock On or Off is not a problem now..if u can just answer for my question .. it is possible to open a word from asp.net apllicatopn and add a custom button Try to Search In googl :-D e

            A 1 Reply Last reply
            0
            • M member27

              Caps lock On or Off is not a problem now..if u can just answer for my question .. it is possible to open a word from asp.net apllicatopn and add a custom button Try to Search In googl :-D e

              A Offline
              A Offline
              Ashfield
              wrote on last edited by
              #6

              cbenan wrote:

              Caps lock On or Off is not a problem

              Typing in capitals is the same as SHOUTING - its considered rude.

              cbenan wrote:

              it is possible to open a word from asp.net apllicatopn and add a custom button

              As I said in point 3 of my previous reply NO

              Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

              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