hi all,
i am trying to delete all connection point of shape using following code
For currentRow = 0 To shape.Section(Visio.VisSectionIndices.visSectionConnectionPts).Count - 1
shape.DeleteRow Visio.VisSectionIndices.visSectionConnectionPts, visRowFirst + currentRow
Next currentRow
and add new connection point to shape and
trying to glue the newly created connection point with connector using following code
Set beginX = connector.CellsSRC(visSectionObject, visRowXForm1D, vis1DBeginX)
Set temp = shape.CellsSRC(visSectionObject, currentRow, Visio.VisCellIndices.visCnnctX)
beginX.GlueTo temp
but it throws error saying inappropriate object
can any one put some light on this part????
thanks in advance
I don't know, if it relates to your error, but as a dump question: What value is in currentRow at the time you Set Temp?
As to deleting all rows: Don't know if neccessary in VBA, but I think it is a best practice, to delete backwards:
For currentRow = shape.Section(Visio.VisSectionIndices.visSectionConnectionPts).Count - 1 To 0 Step -1
Or instead of deleting all the rows you could delete the whole section, recreate it and insert a new row in it. Maybe that is faster.
currentrow is just counter of for loop
e.g
For currentRow = 0 To connectionPoints.count - 1
Set masterObj = ActiveDocument.Masters.ItemU("Dynamic Connector")
Set connector = ActivePage.Drop(masterObj, 1, 1)
Set beginX = connector.CellsSRC(visSectionObject, visRowXForm1D, vis1DBeginX)
Set temp = shape.CellsSRC(visSectionObject, currentRow, Visio.VisCellIndices.visCnnctX)
beginX.GlueTo temp
next currentRow
the point here is it wont allow to glue connector to connection point cell of shape and i dont know why.
but visio allows this
beginX.GlueTo shape.CellsSRC(visSectionObject, visRowXFormOut, visXFormPinX) -- no error for this line
May be, the reason is Visio bug in CellsSRC.
In
Set beginX = myConnector.CellsSRC(visSectionObject, visRowXForm1D, vis1DBeginX)
Set temp = myShape.CellsSRC(visSectionObject, currentRow, Visio.VisCellIndices.visCnnctX)
beginX and temp are changed to something like integer.
You have found a greate bug in Visio.
Next codes run correctly.
Set beginX = myConnector.Cells("BeginX")
Set temp = myShape.Cells("Connections.X1")
beginX.GlueTo temp
Jumpy's correct, you have to delete backwards from the end of the list.
Maybe you should show more code instead of just snippets.
I would guess that your indexes are wrong and you so try to connect to a connection point (row) that doesn't exist. That's the nice thing with JuneTheSeconds code, where he uses shape.Cells(""). If the named cell exists it will work.
Now I see, please replace
Set temp = shape.CellsSRC(visSectionObject, currentRow, Visio.VisCellIndices.visCnnctX)
into
Set temp = Shape.CellsSRC(visSectionConnectionPts, currentRow, visCnnctX)
Browser ID: smf
(is_webkit)
Templates: 1:
Printpage (default).
Sub templates: 4:
init,
print_above,
main,
print_below.
Language files: 1:
index+Modifications.english (default).
Style sheets: 0:
.
Hooks called: 59 (
showintegrate_autoload, cache_get_data, integrate_pre_load, integrate_load_session, integrate_verify_user, cache_get_data, integrate_user_info, integrate_load_board, cache_get_data, integrate_board_info, cache_get_data, integrate_allowed_to_general, integrate_pre_load_theme, cache_get_data, integrate_allowed_to_general, integrate_simple_actions, integrate_allowed_to_general, integrate_load_theme, integrate_pre_log_stats, cache_get_data, integrate_actions, integrate_pre_parsebbc, integrate_bbc_codes, integrate_bbc_print, integrate_post_parsebbc, integrate_pre_parsebbc, integrate_bbc_print, integrate_post_parsebbc, integrate_pre_parsebbc, integrate_bbc_print, integrate_post_parsebbc, integrate_pre_parsebbc, integrate_bbc_print, integrate_post_parsebbc, integrate_pre_parsebbc, integrate_bbc_print, integrate_post_parsebbc, integrate_pre_parsebbc, integrate_bbc_print, integrate_post_parsebbc, integrate_pre_parsebbc, integrate_bbc_print, integrate_post_parsebbc, integrate_allowed_to_general, integrate_allowed_to_general, integrate_allowed_to_general, integrate_allowed_to_general, integrate_allowed_to_general, integrate_allowed_to_general, integrate_allowed_to_general, integrate_allowed_to_general, integrate_allowed_to_general, integrate_allowed_to_general, integrate_menu_buttons, integrate_current_action, integrate_theme_context, integrate_allowed_to_general, integrate_allowed_to_general, integrate_allowed_to_general)
Files included: 25 - 922KB. (
show/home/iw0lkfe3x6cq/public_html/vgforum/index.php, /home/iw0lkfe3x6cq/public_html/vgforum/Settings.php, /home/iw0lkfe3x6cq/public_html/vgforum/cache/db_last_error.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/QueryString.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Subs.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Subs-Auth.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Errors.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Load.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Security.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Subs-Compat.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Subs-Db-mysql.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Cache/CacheApi.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Cache/CacheApiInterface.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Cache/APIs/FileBased.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Subs-Charset.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Unicode/Metadata.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Unicode/QuickCheck.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Session.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Logging.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Class-BrowserDetect.php, (Current Theme)/languages/index.english.php, (Current Theme)/languages/Modifications.english.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Printpage.php, (Current Theme)/Printpage.template.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Unicode/CaseUpper.php)
Memory used: 767KB.
Tokens:
post-login.
Cache hits: 7: 0.00095s for 22,301 bytes (
showget modSettings: 0.00044s - 19982 bytes, get known_languages: 0.00015s - 1277 bytes, get board_parents-0: 0.00010s - 2 bytes, get permissions:-1: 0.00007s - 50 bytes, get theme_settings-1: 0.00009s - 980 bytes, get log_online-update: 0.00008s - 10 bytes, get menu_buttons--1-english: 0.00002s - 0 bytes)
Cache misses: 1: (
showget menu_buttons--1-english)
Queries used: 9.
[Show Queries]