![]() |
Telelogic System Architect (steve huntington) | ![]() |
Topic Title: Unlocking Diagrams in VBA Macro Topic Summary: Unlocking Diagrams in VBA Macro to generate diagram images in MS Word Created On: 6-Aug-2008 15:00 Status: Read Only |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Hello all,
I have several Word macros that connect to System Architect and read information from the currently open encyclopedia in order to generate detailed reports based on information from the Definitions and Diagrams. When the objects are locked I can't generate information about them, for example, when I have to generate the image of a Diagram to the Word report if the Diagram is locked (by a certain user) it throws an error. Currently I verify if the diagram is locked and I jump ahead to the next one, generating a log file that writes the list of all locked objects. What I would like to do is unlock those objects in order to generate the full report without missing any information. I've tried to use the set field function for the diagrams as follows: currentDgm.SetField DIAGFLD_SALOCK, "0" But using this function also throws an error and it seems it's not possible to use it in the macro. Does anyone have any idea? Thank you! José |
|
![]() |
|
![]() |
|
Is there a problem with opening them read only?
|
|
![]() |
|
![]() |
|
That is what I do on all of my data gathering macros by ensuring that the whole encyclopaedia is open read only at the very beginning by having the following incuded in my class module for the encyclopaedia:
Dim oEncyclopedia As Encyclopedia Dim SA_Imf As Object Private Sub Class_Initialize() Dim oApp As SA2001.Application On Error GoTo appOpenError Set oApp = CreateObject("SA2001.Application") Set oEncyclopedia = oApp.Encyclopedia Set SA_Imf = oApp.Interface("ISAImf") oEncyclopedia.OpenObjectsAsReadOnly = True 'need this in case another network user has somthing locked Exit Sub appOpenError: MsgBox "Unable to access the application, have you started System Architect?", vbCritical End Sub |
|
![]() |
|
![]() |
|
Just tried the
Reports -> Word Reports --> Physical Model Reports --> Diagram Report and it did not complain that the diagram was open by another user. Also tried another report invoked from MS Word and that did not complain either. May be it is the code? Providing a skeleton version would assist in locating problem. Have you tried putting your SA session into "Read Only" mode before running the macro? |
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.