You should leave the question in place and post the answer too. That way others could learn from you.

Registered forum members do not see this ad.
declaring a public variable, this is the syntax i used... i cant get it to keep the variable public. it just loses the value after the sub is ran
here is what i have
Code:Public m_letter As String, m_number As String 'end public varible declaration Sub MRevs() Dim gpCode(1) As Integer Dim dataValue(1) As Variant Dim SS_WFrev As AcadSelectionSet SS_delete 1 Set SS_WFrev = ThisDrawing.SelectionSets.Add("SS_WFrev") gpCode(0) = 0: dataValue(0) = "INSERT" gpCode(1) = 2: dataValue(1) = "WFREV" SS_WFrev.Select acSelectionSetAll, , , gpCode, dataValue Dim Cur_Blk As AcadBlockReference Dim Blk_Atts() As AcadAttributeReference Dim Cur_att As AcadAttributeReference Dim i As Integer, n As Integer For i = 0 To SS_WFrev.Count - 1 Set Cur_Blk = SS_WFrev.Item(i) Blk_Atts = Cur_Blk.GetAttributes For n = 0 To UBound(Blk_Atts) Set Cur_att = Blk_Atts(n) If Cur_att.TagString = "REVNO" Then If IsNumeric(Cur_att.TextString) Then If Cur_att.TextString > m_number Then m_number = Cur_att.TextString End If Else If Cur_att.TextString > m_letter Then m_letter = Cur_att.TextString End If End If End If Next n Next i End Sub Sub changerevtri() Dim gpCode(1) As Integer Dim dataValue(1) As Variant Dim SS_Revtag As AcadSelectionSet SS_delete 1 Set SS_Revtag = ThisDrawing.SelectionSets.Add("SS_Revtag") gpCode(0) = 0: dataValue(0) = "INSERT" gpCode(1) = 2: dataValue(1) = "revtag" SS_Revtag.Select acSelectionSetAll, , , gpCode, dataValue Dim Cur_Blk As AcadBlockReference Dim Blk_Atts() As AcadAttributeReference Dim Cur_att As AcadAttributeReference Dim i As Integer, n As Integer For i = 0 To SS_Revtag.Count - 1 Set Cur_Blk = SS_Revtag.Item(i) Blk_Atts = Cur_Blk.GetAttributes For n = 0 To UBound(Blk_Atts) Set Cur_att = Blk_Atts(n) If Cur_att.TagString = "REV#" Then Cur_att.TextString = m_number End If Next n Next i Application.Update End Sub
Last edited by btraemoore; 9th May 2012 at 01:29 pm.
You should leave the question in place and post the answer too. That way others could learn from you.
It's nice to be nice, but sometimes is nicer to be evil!.
![]()
Tip: Please do not PM or email me with CAD questions - use the forums, you'll get an answer sooner.

Okay, i figured out my problem. when i set the pubic variables i set them in between two different subs. To have your variables public and accessible they have to be at the very top of the module you are working on... above all subs just like the example coding.![]()
"Potential has a shelf life." - Margaret Atwood
Bookmarks