A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Powerpoint, Publisher and Visio » Visio
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Doubleclick shape to display link row in external data



 
 
Thread Tools Display Modes
  #1  
Old January 22nd, 2010, 05:21 PM posted to microsoft.public.visio.general
cmorrison
external usenet poster
 
Posts: 4
Default Doubleclick shape to display link row in external data

I would like to create a macro that will display the linked row in the
external data window when i double click a shape. I am using Visio 2007
professional.

Thanks

CMorrison
  #2  
Old January 22nd, 2010, 05:47 PM posted to microsoft.public.visio.general
AlEdlund
external usenet poster
 
Posts: 468
Default Doubleclick shape to display link row in external data

When you say "display the linked row in the external data window ", do you
mean display the data as in a form or merely highlight the row in the
external data window?
Al

"CMorrison" wrote in message
...
I would like to create a macro that will display the linked row in the
external data window when i double click a shape. I am using Visio 2007
professional.

Thanks

CMorrison


  #3  
Old January 22nd, 2010, 07:48 PM posted to microsoft.public.visio.general
cmorrison
external usenet poster
 
Posts: 4
Default Doubleclick shape to display link row in external data

Highlight the row in the external data window. I am trying to do the same
thing as selecting Show Link row from the data menu.

Thanks
Cmorrison

"AlEdlund" wrote:

When you say "display the linked row in the external data window ", do you
mean display the data as in a form or merely highlight the row in the
external data window?
Al

"CMorrison" wrote in message
...
I would like to create a macro that will display the linked row in the
external data window when i double click a shape. I am using Visio 2007
professional.

Thanks

CMorrison


  #4  
Old January 22nd, 2010, 09:02 PM posted to microsoft.public.visio.general
AlEdlund
external usenet poster
 
Posts: 468
Default Doubleclick shape to display link row in external data

you might try something like this
al


Private Sub ShowSelectedObjectDataRecord(visShape As Visio.Shape)
'
' this piece of code handles selecting an object and then if it
' is linked to a data recordset, open the external data window and
' select the recordset and record appropriate to the object
'
Dim alngDataRecordsetIDs() As Long
Dim lngRowId As Long
Dim lngRecordSetId As Long
Dim winExternalData As Visio.Window
Dim visDataRecordset As Visio.DataRecordset
Dim intX As Integer

' get the list of recordset ids associated if any
visShape.GetLinkedDataRecordsetIDs alngDataRecordsetIDs

If UBound(alngDataRecordsetIDs) -1 Then
' take the first recordset id
lngRecordSetId = alngDataRecordsetIDs(0)
' get the associate row id
lngRowId = visShape.GetLinkedDataRow(lngRecordSetId)
Set winExternalData =
Application.ActiveWindow.Windows.ItemFromID(visWin IDExternalData)
' show the external data window
winExternalData.Visible = True
' set the linked row
Set visDataRecordset =
Application.ActiveDocument.DataRecordsets.ItemFrom ID(lngRecordSetId)
winExternalData.SelectedDataRecordset = visDataRecordset
winExternalData.SelectedDataRowID = lngRowId
End If ' test for number of recorsetids associated


End Sub



"CMorrison" wrote in message
...
Highlight the row in the external data window. I am trying to do the same
thing as selecting Show Link row from the data menu.

Thanks
Cmorrison

"AlEdlund" wrote:

When you say "display the linked row in the external data window ", do
you
mean display the data as in a form or merely highlight the row in the
external data window?
Al

"CMorrison" wrote in message
...
I would like to create a macro that will display the linked row in the
external data window when i double click a shape. I am using Visio 2007
professional.

Thanks

CMorrison


  #5  
Old January 22nd, 2010, 09:38 PM posted to microsoft.public.visio.general
cmorrison
external usenet poster
 
Posts: 4
Default Doubleclick shape to display link row in external data

Thank you. Can i just copy this into a macro and run it, when I double click
the shape?

"AlEdlund" wrote:

you might try something like this
al


Private Sub ShowSelectedObjectDataRecord(visShape As Visio.Shape)
'
' this piece of code handles selecting an object and then if it
' is linked to a data recordset, open the external data window and
' select the recordset and record appropriate to the object
'
Dim alngDataRecordsetIDs() As Long
Dim lngRowId As Long
Dim lngRecordSetId As Long
Dim winExternalData As Visio.Window
Dim visDataRecordset As Visio.DataRecordset
Dim intX As Integer

' get the list of recordset ids associated if any
visShape.GetLinkedDataRecordsetIDs alngDataRecordsetIDs

If UBound(alngDataRecordsetIDs) -1 Then
' take the first recordset id
lngRecordSetId = alngDataRecordsetIDs(0)
' get the associate row id
lngRowId = visShape.GetLinkedDataRow(lngRecordSetId)
Set winExternalData =
Application.ActiveWindow.Windows.ItemFromID(visWin IDExternalData)
' show the external data window
winExternalData.Visible = True
' set the linked row
Set visDataRecordset =
Application.ActiveDocument.DataRecordsets.ItemFrom ID(lngRecordSetId)
winExternalData.SelectedDataRecordset = visDataRecordset
winExternalData.SelectedDataRowID = lngRowId
End If ' test for number of recorsetids associated


End Sub



"CMorrison" wrote in message
...
Highlight the row in the external data window. I am trying to do the same
thing as selecting Show Link row from the data menu.

Thanks
Cmorrison

"AlEdlund" wrote:

When you say "display the linked row in the external data window ", do
you
mean display the data as in a form or merely highlight the row in the
external data window?
Al

"CMorrison" wrote in message
...
I would like to create a macro that will display the linked row in the
external data window when i double click a shape. I am using Visio 2007
professional.

Thanks

CMorrison

  #6  
Old January 23rd, 2010, 05:47 AM posted to microsoft.public.visio.general
AlEdlund
external usenet poster
 
Posts: 468
Default Doubleclick shape to display link row in external data

One of the great tools in Visio is the macro recorder. You can use it to see
what happens when a shape is selected. The code I posted needs to know what
shape is selected before it can be run.
Short answer is that your 'double-click' code will have to identify the
shape from where the event is originating and then call the code I posted.
al


"CMorrison" wrote in message
...
Thank you. Can i just copy this into a macro and run it, when I double
click
the shape?

"AlEdlund" wrote:

you might try something like this
al


Private Sub ShowSelectedObjectDataRecord(visShape As Visio.Shape)
'
' this piece of code handles selecting an object and then if it
' is linked to a data recordset, open the external data window and
' select the recordset and record appropriate to the object
'
Dim alngDataRecordsetIDs() As Long
Dim lngRowId As Long
Dim lngRecordSetId As Long
Dim winExternalData As Visio.Window
Dim visDataRecordset As Visio.DataRecordset
Dim intX As Integer

' get the list of recordset ids associated if any
visShape.GetLinkedDataRecordsetIDs alngDataRecordsetIDs

If UBound(alngDataRecordsetIDs) -1 Then
' take the first recordset id
lngRecordSetId = alngDataRecordsetIDs(0)
' get the associate row id
lngRowId = visShape.GetLinkedDataRow(lngRecordSetId)
Set winExternalData =
Application.ActiveWindow.Windows.ItemFromID(visWin IDExternalData)
' show the external data window
winExternalData.Visible = True
' set the linked row
Set visDataRecordset =
Application.ActiveDocument.DataRecordsets.ItemFrom ID(lngRecordSetId)
winExternalData.SelectedDataRecordset = visDataRecordset
winExternalData.SelectedDataRowID = lngRowId
End If ' test for number of recorsetids associated


End Sub



"CMorrison" wrote in message
...
Highlight the row in the external data window. I am trying to do the
same
thing as selecting Show Link row from the data menu.

Thanks
Cmorrison

"AlEdlund" wrote:

When you say "display the linked row in the external data window ",
do
you
mean display the data as in a form or merely highlight the row in the
external data window?
Al

"CMorrison" wrote in message
...
I would like to create a macro that will display the linked row in
the
external data window when i double click a shape. I am using Visio
2007
professional.

Thanks

CMorrison

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:39 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.