Hey guys,
I'm new to this Visio topic, also my VBA skills are not A+ level. However, what I want to do is to change in a information flow shape the "Text Field"-Value of all Information Flow and Information Flow Bidirectional and Information Flow without direction.
To change this value in a single information flow it is like this:
Application.ActiveWindow.Shape.CellsSRC(visSectionTextField, 0, visFieldCell).FormulaU = "Prop._VisDM_Prop_InformationObjects"
But how I can get only, but all three Information Flow types in a Shape? Ok, I know with a loop, but how to catch not an Application?
Best regards
Amax
Hello Amax,
Which stencil and template is this from? Also, are you trying to change on document or multiple ones?
Best regards
John
Hi John,
the used stecils are: InformationFlow, InformationFlowBidirectional, InformationflowNoDirection, Application-cp-s-Bo, Application-cp-s-Small, Application-cp-m-Bo, Application-cp-m-Small.
In the properties is the template information empty. As far as I know, this sheet is generated by a tool for drawing information flow diagrams.
I try to change one document, but use a external excel file to link the relevant information I want to change with the current one stored in the visio file.
Hi,
I think you're describing Master names rather than a stencil, which is the document that contains a set of masters? I'm not familiar with the shapes you're describing, but is sounds like editting the document master shapes manually might be a better choice. Do you have a sample document that you could post so we know what we're dealing with?
Best regards
John
Hey John,
I'm sorry that I can't be specific enough. Attached the file.
regards
Hi,
Thanks - that's helpful.
So as I understand it you want to edit the text fields of three of the Information type connector shapes - is that right?
I see that a number of the shapes have local formulas (ie they do not inherit this information from their respective masters) and I think my approach would be to reset inheritance so that you can then edit the master manually in one place, and have the changes reflected across all of the instance shapes.
Anyway, it's up to you obviously, so I've included both options in the code below:
Public Sub ResetPageInfoConns()
Dim newFormula As String
'uncomment this line to reset the field cell's inheritance to point at the master
'newFormula = "="
'or uncomment this line to set the instance (if you must!):
'newFormula = "Prop._VisDM_Prop_InformationObjects"
Dim masterNames As Variant
masterNames = Split("InformationFlow;InformationFlowBidirectional;InformationFlowNoDirection", ";", newFormula)
Call ResetFields(ActivePage, masterNames, newFormula)
End Sub
Private Sub ResetFields(ByRef targetPage As Visio.Page, masterNames As Variant, newFormula As String)
Dim shp As Visio.Shape
If Not targetPage Is Nothing Then
For Each shp In targetPage.Shapes
If Not shp.Master Is Nothing Then
Dim i As Long
For i = 0 To UBound(masterNames)
If shp.Master.Name = masterNames(i) Then
If shp.CellsSRCExists(visSectionTextField, 0, visFieldCell, VisExistsFlags.visExistsLocally) Then
Debug.Print shp.Master.Name, shp.NameID, "Found shape with field"
'uncomment to set the cell
'shp.CellsSRC(visSectionTextField, 0, visFieldCell).FormulaU = newFormula
Else
Debug.Print shp.Master.Name, shp.NameID, "Found shape with no field"
End If
End If
Next i
End If
Next
End If
End Sub
Let me know how you get on.
Best regards
John
Great, it works! Thank you!
Great. Glad it worked for you.
Best regards
John
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: 62 (
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_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 - 925KB. (
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: 762KB.
Tokens:
post-login.
Cache hits: 7: 0.00096s for 22,301 bytes (
showget modSettings: 0.00043s - 19982 bytes, get known_languages: 0.00014s - 1277 bytes, get board_parents-0: 0.00010s - 2 bytes, get permissions:-1: 0.00009s - 50 bytes, get theme_settings-1: 0.00011s - 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]