HOME
Microgold offers technical assistance on a number of different levels depending on the tech support package that you purchase with your software. Many questions can be answered by simply reviewing the topics under our FAQs. We can be contacted by phone or email, or through the web interface.
VBA FAQs  
The section below covers frequently asked questions about VBA software, language and interface. Click each question for detailed answers with diagrams.

Q: How Do I add my own routines to VBA?
Q: How Do I Get started declaring my WithClass Object?
Q: How do I access the Classes showing on my WithClass screen?
Q: How do I access Attributes and Operations in my Class?
Q: How do I get started declaring my WithClass object?
Q: How do I access Attributes and Operations in my Class?
Q: How can I paste a portion of my diagram into Word using VBA?
Q: How Do I access States from my state diagram in VBA?
Q: How do I use the GetNext feature in collections?
Q: How do I access related classes such as Base Classes of my Class?
Q: How do I access relations leaving or entering the Class?
Q: How do I batch the existing scripting in WithClass from VBA?
Q: How do I Trigger my own code on WithClass Events?
Q: How do I Draw States and Transitions using VBA?
Q: How do I Do My Own Reverse Engineering using VBA?
Q: How do I Do Extract descriptions from use cases in use case diagrams?

 

Q: How Do I add my own routines to VBA?

Adding new routines to the VBA library is fairly straightforward:
1. Go into the VBA Editor From the Utilities menu in WithClass
2. Click on the WithClass_Macros Project title
3. Insert a module from the Insert Menu
4. Change the name of the module in the properties window by clicking on the name of the module and typing in your own name
5. Start writing your subroutines in the editor window.

Q: How do I get started declaring my WithClass object?

If you are using VBA within WithClass, You can use the global ActiveDocument pointer to access all of your information in the current active document so you don't really need to declare a WithClass object. However you could declare a reference to your active document as follows:

Dim wcDocument As With_Class.Document
Set wcDocument = With_Class.ActiveDocument

Q: How do I access the classes showing on my WithClass screen?

You can cycle through all the classes out of the current document by declaring a class collection and then cycling through all the classes in the current document. The following Code prints the name of all the classes in the document

Dim ClassList As With_Class.Classes
Dim CurrentClass As With_Class.Class
Dim iCount As Integer
Dim j As Integer

Set ClassList = wcDocument.Classes
iCount = ClassList.Count
For j = 1 to iCount
Set CurrentClass = ClassList.Item(j)
Print CurrentClass.Name
Next j

Q:How do I access Attributes and Operations in my Class?

To access an Attribute, you have to access the attribute collection in the class. Operations are accessed in the same way. The following code gets the last Attribute in the attribute list and prints its type:

Dim CurrentAttribute As With_Class.Attribute
Dim AttributeList As With_Class.Attributes
Dim iCount As Integer;
Set AttributeList = CurrentClass.Attributes
iCount = AttributeList.Count
Set CurrentAttribute = AttributeList.Item(iCount)
Print CurrentAttribute.Type

Q: How do I get started declaring my WithClass object?

If you are using VBA within WithClass, You can use the global ActiveDocument pointer to access all of your information in the current active document so you don't really need to declare a WithClass object. However you could declare a reference to your active document as follows:

Dim wcDocument As With_Class.Document
Set wcDocument = With_Class.ActiveDocument

Q:How do I access Attributes and Operations in my Class?

To access an Attribute, you have to access the attribute collection in the class. Operations are accessed in the same way. The following code gets the last Attribute in the attribute list and prints its type:

Dim CurrentAttribute As With_Class.Attribute
Dim AttributeList As With_Class.Attributes
Dim iCount As Integer;
Set AttributeList = CurrentClass.Attributes
iCount = AttributeList.Count
Set CurrentAttribute = AttributeList.Item(iCount)
Print CurrentAttribute.Type

Q: How can I paste a portion of my diagram into Word using VBA?

You can use the method CopyRegionToClipBoard in the Document interface to clip a region of your diagram. You just specify the rectangular coordinatesyou want to clip. The example below clips a region of about 7 x 7" of the first page and pastes it into word:
Dim wcDocument As With_Class.Document
Dim ThisWord As Word.Application
Dim newDoc As Object
Set wcDocument = CurrentDocument
Set ThisWord = CreateObject("Word.application")
Set newDoc = ThisWord.Documents.Add
wcDocument.CopyRegionToClipBoard 0, 0, 500, 500
ThisWord.Selection.Paste

Q: How Do I access States from my state diagram in VBA?

Accessing states is done in much the same way as accessing classes. The document has a state collection called states, just like it has a classcollection. The code below cycles through all the states and prints out a state Description:
Dim StateList As With_Class.States
Dim CurrentState As With_Class.State
Dim iCount As Integer Dim j As Integer
Set StateList = wcDocument.States
iCount = StateList.Count
For j = 1 to iCount
Set CurrentState = StateList.Item(j)
Print CurrentState.Description
Next j

Q: How do I use the GetNext feature in collections?

WithClass provides 2 ways to cycle through collections. The first we've seen is Using Item(I), but the other way, which turns out to be more efficient, is using GetNext. The way GetNext is implemented is you must "Restart" your collection each time you use it and then detect the last element by using "IsLast". Below is an example of cycling through classes using the GetNext feature:
Dim ClassList As With_Class.Classes
Dim CurrentClass As With_Class.Class
Dim strClass As String
Set ClassList = CurrentDocument.Classes
ClassList.Restart
While (ClassList.IsLast = False)
Set CurrentClass = ClassList.GetNext
strClass = CurrentClass.Name
Print strClass
Wend

Q: How do I access related classes such as Base Classes of my Class?

Related classes, that is classes connected with a relationship line, can be accessed by using the relation class collections SuperClasses, AssociationClasses, AggregationClasses, and Dependency Classes. Below is an example that prints out all base classes of the current class:
Dim BaseList As With_Class.Classes
Dim iCount As Integer
Dim j As Integer
Dim CurrentBaseClass As Class
Set BaseList = CurrentClass.SuperClasses
iCount = BaseList.Count
For j = 1 to iCount
Set CurrentBaseClass = BaseList.Item(j)
Print CurrentBaseClass.Name
Next j

Q: How do I put a new class in my document?

WithClass has the ability to draw classes and populate them from VBA.You just need to specify the coordinates of the class and its name and an object to the class is returned. You can then add attributes and operations using the new object The Code below makes a package Called AnimalPack and adds a class Dog . It then adds an attribute color to dog.
Dim CurrentPackage As With_Class.Package
Dim CurrentClass As With_Class.Class
Set CurrentPackage = CurrentDocument.NewPackage(180, 560, "AnimalPack")
Set CurrentClass = CurrentPackage.NewClass(100, 250, "Dog")
CurrentClass.NewAttribute("color")

Q: How do I access relations leaving or entering the Class?

Relationships can be accessed from a Class through the RelationsIn andRelationsOut property: Below is an example that prints the role name of all aggregate relations Leaving the CurrentClass:
Dim RelationList As With_Class.Relationships
Dim CurrentRelation As With_Class.Relationship
Dim iCount As Integer
Dim j As Integer
Set RelationList = CurrentClass.RelationsOut
iCount = RelationList.Count
For j = 1 to iCount
Set CurrentRelation = RelationList.Item(j)
If CurrentRelation.Type == "Aggregation" Then
Print CurrentRelation.RoleName
End If
Next j

Q: How do I batch the existing scripting in WithClass from VBA?

You can actually run WithClass's internal scripting at the class level using the VBA Macro property RunClassScript. You just need to pass the class object, the name of the script and the extension you wish to tagonto the final file output name. For example RunClassScript(CurrentClass.Name,"vcfunc0.sct", ".cpp") would generate foo.cpp using The vcfunc0.sct scriptif the CurrentClass.Name is foo. Below is an example that cycles through all classes using the vcfunc0.sct script:
Dim ClassList As With_Class.Classes
Dim CurrentClass As With_Class.Class;
Dim iCount As Integer
Dim j As Integer
Dim strScriptDir As String
strScriptDir = "c:\program files\wc98\scripts\"
Set ClassList = wcDocument.Classes
iCount = ClassList.Count
For j = 1 to iCount
Set CurrentClass = ClassList.Item(j)
wcDocument.RunClassScript(CurrentClass.Name, strScriptDir + "vcfunc0.sct","*.cpp")
Next j

Q: How do I trigger my own code on WithClass events?

WithClass (version 5.03) has several events that you can utilize to insert your own code after these events occur. There are events like ClassSelected, AttributeChanged, ClassMoved. To utilize the events in WithClass, double click on the ThisDocument in wc98 objects in the VBA Editor. Click on the combo box on the upper left hand corner that says General and choose Document. The events will appear on the right side and you can choose the event function you want from this list. The VBA IDE will automatically insert the function for you. Below is the code for the operationchanged event. This will be triggered after the user makes changes to their operation in an operation dialog. Note that the event supplies the operation that has been changed:

Private Sub Document_OperationChanged(ByVal TheChangedOperation As Object)
MsgBox("The Operation that was changed was " & TheChangedOperation.Name)
End Sub

Q: How do I draw States and Transitions using VBA?

WithClass 5.03 allows you to draw states and transitions. 5.03 also provides some global constants so you can pick which state you are going to draw:
Dim wcDocument As With_Class.Document
Dim state1 As With_Class.State
Dim state2 As With_Class.State
Dim trans1 As With_Class.Transition
Dim trans2 As With_Class.Transition
Set wcDocument = With_Class.ActiveDocument
wcDocument.ShowView (wcvState)
Set state1 = wcDocument.NewState(100, 20, "ON", wcsInitial)
Set state2 = wcDocument.NewState(100, 200, "OFF", wcsTerminal)
Set trans1 = wcDocument.NewTransition(state1, state2, "switchedOn", "temp > 10", "turnOn")
Set trans2 = wcDocument.NewTransition(state2, state1, "switchedOff", "temp < 20", "turnOff")

as several events that you can utilize to insert your own code after these events occur. There are events like ClassSelected, AttributeChanged, ClassMoved. To utilize the events in WithClass, double click on the ThisDocument in wc98 objects in the VBA Editor. Click on the combo box on the upper left hand corner that says General and choose Document. The events will appear on the right side and you can choose the event function you want from this list. The VBA IDE will automatically insert the function for you. Below is the code for the operationchanged event. This will be triggered after the user makes changes to their operation in an operation dialog. Note that the event supplies the operation that has been changed:

Private Sub Document_OperationChanged(ByVal TheChangedOperation As Object)
MsgBox("The Operation that was changed was " & TheChangedOperation.Name)
End Sub

Q: How do I do my own reverse engineering using VBA?

This is probably to in depth to discuss in a few brief statements so we have provided an example. WithClass 2000 comes with a Parser object that eases creation of your own reverse engineering scripts and addins. The example we provide is how to reverse engineer a perl class using WithClass. This same example can be applied to reversing other languages

Q: How do I do extract descriptions from use cases in use case diagrams?

WithClass 2000 adds a bunch of new diagrams where you can access components in the diagram using vba collections. Below is an example for looping through use cases and printing out descriptions in a message box
Dim Diagram As With_Class.UseCaseDiagram
Dim MyCases As With_Class.WCCollection
Dim MyCase As With_Class.Shape
Set wcDocument = With_Class.ActiveDocument
Set Diagram = wcDocument.UseCaseDiagrams.Item(1)
Set MyCases = Diagram.Cases
MyCases.Restart
While (MyCases.IsLast = False)
Set MyCase = MyCases.GetNext
MsgBox (MyCase.Description)
Wend
End Sub

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   
 
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

GOLD TECH 1 | GOLD TECH 2 | GOLD TECH 3 |
WITH CLASS FAQ | VBA FAQ | UML FAQ
buy cialis cialisfunsurforg cialisfunsurforg onlinehtml site cialis and back pain cialis levitra vs combine viagra and cialis allowed black buy casino cialis diet gambling health jack phentermine poker tag viagra xhtml canada over the counter cialis viagra cialis generic viagra cialis viagra levitra prices women take cialis drug buy cialis tadalafil cialis drinking alcohol cialis online usa levitra vs cialis vs viagra brand name cialis cheapest soft cialis cialis get viagra cialis viagra taking cialis with viagra buy cialis where cialis drugs cialis over dose lowest price generic cialis buy cialis generic ciales web site marketing cialis interaction precautions cialis western open add cialis link new buying generic cialis cialis free cialis suggest url valium detox buy cialis pharmacy cialis experience cialis pills online cialis buy cialis dream pharmaceutical cialis and oral sex cialis lawyer columbus compare viagra cialis levitra viagra cialis levitra buy cialis shop tadalafil cialis fast heart rate cialis online pharmacy online pharmacy cialis seychelles buy cialis ebay find tadalafil cheap cialis cialis injury attorney cincinnati cialis uk similar drugs for cialis buy cialis online submit=buy cialis online cialis dose it work cialis no prescription needed generic cialis muncie indiana buy cialis genericf hostingcom link cialis cheap no prescription cialis injury attorney cleveland cialis versus viagra 20mg cialis canada cialis deals cialis forum cialis free consultation cialis sample price viagra cialis levitra buy cialis link onlineinttc cialis class action lawsuit cialis levitra combine cialis and levitra viagra allowed black buy casino cialis diet gambling jack low online order phentermine poker tag viagra xhtml can cialis and viagra be taken together cialis free sample coupon cialis soft tab online consultation purchase cialis buy cialis online us cialis commercial cialis line differences viagra cialis levitra allowed black casino cialis diet gambling health jack phentermine poker tag viagra xhtml can i get cialis in canada cialis free samples cialis samples sale without prescription cialis in detroit area buy cialis cialis drug prescription cialis on second attempt generic viagra cialis levitra best cialis price canadian perscription of cialis cialis free trial cialis site suggest samples of viagra cialis levitra buy cialis now cialis cheap cialis injury lawyer ohio cialis viagra vs valium buying online buy discount cialis cialis effects side cialis online discount cialis soft allowed black buy casino cialis diet gambling jack online order phentermine poker tag viagra xhtml by cialis comment post posted cialis for sale on line cialis prescription las posas de ciales buy canada cialis cheap generic cialis cialis generic price cialis soft tab prescription cialis on line buy cialis online viagra cialis compare levitra cialis link online suggest discount generic cialis . buy tadalafil cialis cialis for sale cialis open western lowest cialis levitra prices buy cialis dosage effects online side warning cheap cialis generic cialis free sample cialis soft tab online consultation usa side effects of cialis buy cialis link suggest cialis attorney columbus cialis information pamphlet cialis stories viagra cialis generica buy cialis viagra cialis compared to viagra cialis new viagra dangers of taking cialis allowed cialis tag viagra xhtml canada cialis cialis for woman cialis overnight hypertension treatment using cialis buy cheap cialis canadian cialis cialis for women cialis price order cialis submit=order cialis buy cialis in the uk cheapest cialis generic cialis generic cialis sale review cialis levitra viagra buy cialis link onlinenew pharminfo cialis and liver disease cialis how to avoid backache cialis soft tabs penis pump plus cialis buy cialis online cialis comparison levitra viagra cialis icos lily online cialis tadalafil swflash 1.cab buy cialis online dreampharmaceuticals cialis co drug eli impotence lilly cialis julilatiwaveprohostingcom link onlinehtml cialis samples submit=cialis samples mixing cialis and viagra buy cialis without prescription cheap cialis submit=cheap cialis cialis female view cialis review lawsuits involving blindness caused by cialis buy cialis generic online canada cialis line cialis female opinion cialis online submit=cialis online generic cialis submit=generic cialis buy cialis link onlinenettc can you mix cialis and viagra cialis fda approval cialis online buy generic cialis 20 mg best price cialis buy viagra cialis levitra cialis erectile dysfunction cialis official website erection does not go down after taking cialis black casino cialis diet followup gambling health jack phentermine poker post viagra cialis 20mg cialis generic link suggest cialis woman sitemap2 add cialis link buy generic cialis cialis dosage cialis melt packs buy generic cialis online