Presentation is loading. Please wait.

Presentation is loading. Please wait.

A Graphics Component For Microsoft ® Office Applications; Programming In Visio – Part 2 Mr. David A. Edson, M.Arch. Technical Product Manager Developer.

Similar presentations


Presentation on theme: "A Graphics Component For Microsoft ® Office Applications; Programming In Visio – Part 2 Mr. David A. Edson, M.Arch. Technical Product Manager Developer."— Presentation transcript:

1 A Graphics Component For Microsoft ® Office Applications; Programming In Visio – Part 2 Mr. David A. Edson, M.Arch. Technical Product Manager Developer Tools Microsoft Corporation 4-406

2

3 Data Across The Business Enterprise Data is generated every moment of every business day Data is generated every moment of every business day Data traditionally has been formatted by the application that hosted its input or creation Data traditionally has been formatted by the application that hosted its input or creation Data sharing Data sharing  The paper trail  The lowest common denominator  “Not with MY data, you don’t!” Data Rich versus Data Shared Data Rich versus Data Shared

4 Data Formats And Types Word data Word data  Text – Rich and plain Excel data Excel data  Text, numbers and formulas in wee boxes Access data Access data  Text, numbers and Booleans in fields within records PowerPoint ® data PowerPoint ® data  A mixed bag of text and graphics Outlook ® data Outlook ® data  Potpourri of data types in applets Visio Data Visio Data  Text, numbers, and formulas, and Booleans in cells within ShapeSheets for SmartShape symbols

5 How Can Data Be Shared? Do we have to revert to the lowest common denominator? Do we have to revert to the lowest common denominator? What is lost in the process? What is lost in the process? How can data types and formats be preserved? How can data types and formats be preserved? DDE, OLE, ActiveX ®, COM, DNA, IRS, MSFT, INTC, TLA DDE, OLE, ActiveX ®, COM, DNA, IRS, MSFT, INTC, TLA Remember the Clipboard – (?/!) Remember the Clipboard – (?/!) Rural Lane or Bi-Directional Motorway? Rural Lane or Bi-Directional Motorway?

6 Data Shared Via Object Models Declare your Data Types for Transmission and Receipt Declare your Data Types for Transmission and Receipt Let Windows suss out the carrier Let Windows suss out the carrier Remember what Object actually holds the data Remember what Object actually holds the data Three rules: Three rules:  Declare  Assign  Purge

7 Visio Data Passed To Excel Public Sub Transfer() Dim shpObj As Visio.Shape Dim shpObj As Visio.Shape Dim celObj As Visio.Cell Dim celObj As Visio.Cell Dim xlApp As Excel.Application Dim xlApp As Excel.Application Dim xlBook As Excel.Workbook Dim xlBook As Excel.Workbook Dim xlSheet As Excel.Worksheet Dim xlSheet As Excel.Worksheet Dim szFolderType As String Dim szFolderType As String Dim szOwner As String Dim szOwner As String Dim szDepartment As String Dim szDepartment As String Set shpObj = Visio.ActiveWindow.Selection.Item(1) Set shpObj = Visio.ActiveWindow.Selection.Item(1) Set celObj = shpObj.Cells("Prop.Owner") Set celObj = shpObj.Cells("Prop.Owner") szOwner = celObj.ResultStr("") szOwner = celObj.ResultStr("")

8 Visio Data Passed To Excel Set celObj = shpObj.Cells("Prop.Department") Set celObj = shpObj.Cells("Prop.Department") szDepartment = celObj.ResultStr("") szDepartment = celObj.ResultStr("") szFolderType = shpObj.Text szFolderType = shpObj.Text Set xlApp = CreateObject("Excel.Application") Set xlApp = CreateObject("Excel.Application") xlApp.Visible = True xlApp.Visible = True Set xlBook = xlApp.Workbooks.Add Set xlBook = xlApp.Workbooks.Add Set xlSheet = xlBook.Worksheets(1) Set xlSheet = xlBook.Worksheets(1) xlSheet.Cells(1, 1).Value = "Owner" xlSheet.Cells(1, 1).Value = "Owner" xlSheet.Cells(1, 2).Value = "Department" xlSheet.Cells(1, 2).Value = "Department" xlSheet.Cells(1, 3).Value = "Type" xlSheet.Cells(1, 3).Value = "Type" xlSheet.Cells(2, 1).Value = szOwner xlSheet.Cells(2, 1).Value = szOwner xlSheet.Cells(2, 2).Value = szDepartment xlSheet.Cells(2, 2).Value = szDepartment xlSheet.Cells(2, 3).Value = szFolderType xlSheet.Cells(2, 3).Value = szFolderType End Sub

9 Excel Data Passed To Visio Public Sub MakeVisioFlowchartBox() Dim xlSheet As Excel.Worksheet Dim xlSheet As Excel.Worksheet Dim appVisio As Visio.Application Dim appVisio As Visio.Application Dim docsObj As Visio.Documents Dim docsObj As Visio.Documents Dim docObj As Visio.Document Dim docObj As Visio.Document Dim stnObj As Visio.Document Dim stnObj As Visio.Document Dim mastObj As Visio.Master Dim mastObj As Visio.Master Dim pagObj As Visio.Page Dim pagObj As Visio.Page Dim shpObj As Visio.Shape Dim shpObj As Visio.Shape Dim celObj As Visio.Cell Dim celObj As Visio.Cell

10 Excel Data Passed To Visio Set xlSheet = Excel.ActiveSheet Set appVisio = CreateObject("Visio.Application") Set appVisio = CreateObject("Visio.Application") Set docsObj = appVisio.Documents Set docsObj = appVisio.Documents Set docObj = docsObj.Add("Basic Flowchart.VST") Set docObj = docsObj.Add("Basic Flowchart.VST") Set pagObj = docObj.Pages.Item(1) Set pagObj = docObj.Pages.Item(1) Set stnObj = docsObj.Item("Basic Flowchart Shapes.VSS") Set stnObj = docsObj.Item("Basic Flowchart Shapes.VSS") Set mastObj = stnObj.Masters.Item("Process") Set mastObj = stnObj.Masters.Item("Process") Set shpObj = pagObj.Drop(mastObj, 4.25, 5.5) Set shpObj = pagObj.Drop(mastObj, 4.25, 5.5) Set celObj = shpObj.Cells("Prop.Cost") Set celObj = shpObj.Cells("Prop.Cost") celObj.Formula = xlSheet.Cells(2, 1).Value celObj.Formula = xlSheet.Cells(2, 1).Value Set celObj = shpObj.Cells("Prop.Duration") Set celObj = shpObj.Cells("Prop.Duration") celObj.Formula = xlSheet.Cells(2, 2).Value celObj.Formula = xlSheet.Cells(2, 2).Value Set celObj = shpObj.Cells("Prop.Resources") Set celObj = shpObj.Cells("Prop.Resources") celObj.Formula = xlSheet.Cells(2, 3).Value celObj.Formula = xlSheet.Cells(2, 3).Value End Sub

11 Visio Data Passed To Word Public Sub SendCPU() Dim shpObj As Visio.Shape Dim shpObj As Visio.Shape Dim celObj As Visio.Cell Dim celObj As Visio.Cell Dim wrdObjsel As Word.Selection Dim wrdObjsel As Word.Selection Dim wrdApp As Word.Application Dim wrdApp As Word.Application Set wrdApp = CreateObject("Word.Application") Set wrdApp = CreateObject("Word.Application") wrdApp.Visible = True wrdApp.Visible = True Set wrdDocObj = wrdApp.Documents.Add("Normal.dot") Set wrdDocObj = wrdApp.Documents.Add("Normal.dot") Set wrdObjsel = wrdDocObj.ActiveWindow.Selection Set wrdObjsel = wrdDocObj.ActiveWindow.Selection Set shpObj = Visio.ActiveWindow.Selection.Item(1) Set shpObj = Visio.ActiveWindow.Selection.Item(1) Set celObj = shpObj.Cells("Prop.AssetNumber") Set celObj = shpObj.Cells("Prop.AssetNumber") wrdObjsel.TypeText celObj.ResultStr("") wrdObjsel.TypeText celObj.ResultStr("") wrdObjsel.TypeParagraph wrdObjsel.TypeParagraph Set celObj = shpObj.Cells("Prop.SerialNumber") Set celObj = shpObj.Cells("Prop.SerialNumber") wrdObjsel.TypeText celObj.ResultStr("") wrdObjsel.TypeText celObj.ResultStr("") wrdObjsel.TypeParagraph wrdObjsel.TypeParagraph Set celObj = shpObj.Cells("Prop.Location") Set celObj = shpObj.Cells("Prop.Location") wrdObjsel.TypeText celObj.ResultStr("") wrdObjsel.TypeText celObj.ResultStr("") wrdObjsel.TypeParagraph wrdObjsel.TypeParagraph End Sub

12 Word Data Passed To Visio Public Sub SendOffToVisio() Dim appVisio As Visio.Application Dim appVisio As Visio.Application Dim docsObj As Visio.Documents Dim docsObj As Visio.Documents Dim docObj As Visio.Document Dim docObj As Visio.Document Dim pagObj As Visio.Page Dim pagObj As Visio.Page Dim shpObj As Visio.Shape Dim shpObj As Visio.Shape Dim wrdSelObj As Word.Selection Dim wrdSelObj As Word.Selection Selection.WholeStory Selection.WholeStory Set wrdSelObj = Word.ActiveWindow.Selection Set wrdSelObj = Word.ActiveWindow.Selection Set appVisio = CreateObject("Visio.Application") Set appVisio = CreateObject("Visio.Application") Set docsObj = appVisio.Documents Set docsObj = appVisio.Documents Set docObj = docsObj.Add("") Set docObj = docsObj.Add("") Set pagObj = docObj.Pages.Item(1) Set pagObj = docObj.Pages.Item(1) Set shpObj = pagObj.DrawRectangle(2, 9, 6.5, 2) Set shpObj = pagObj.DrawRectangle(2, 9, 6.5, 2) shpObj.Text = wrdSelObj shpObj.Text = wrdSelObj End Sub

13 Data Passed Between Access And Visio

14 Thank You! Remember your evaluations (what can make this better?) Contact: Contact:  Mr. David A. Edson, M.Arch. Technical Product Manager Developer Tools Marketing Microsoft Corporation

15


Download ppt "A Graphics Component For Microsoft ® Office Applications; Programming In Visio – Part 2 Mr. David A. Edson, M.Arch. Technical Product Manager Developer."

Similar presentations


Ads by Google