PDA

View Full Version : Solved: Clearing the Stack Space using VBA



Solrac3030
06-18-2009, 04:09 PM
I'm getting an error stating Out of Stack Space when running a particular form in a template. Is there a way to clear the Stack Space using VBA. This is the code in the form causing the error.


Option Explicit
Private Sub cmdOk_Click()
Selection.TypeText Text:=vbCr & vbTab & txtSections.Value
Unload Me
End Sub
Private Sub optNo_Click()
frmSections.Height = 117
cmdOK.Visible = True
End Sub
Private Sub optYes_Click()
ActiveDocument.Bookmarks("Sections").Select
Selection.TypeText Text:=vbCr & vbTab & txtSections.Value
Label1.Visible = False
Label3.Visible = True
optYes.Visible = False
optYes1.Visible = True
optNo.Value = False
txtSections.Value = Null
txtSections.SetFocus
End Sub
Private Sub optYes1_Click()
Selection.TypeText Text:=vbCr & vbTab & txtSections.Value
optNo.Value = False
optYes1.Value = False
txtSections.Value = Null
txtSections.SetFocus
End Sub
Private Sub UserForm_Initialize()
cmdOK.Visible = False
frmSections.Height = 90
End Sub



User starts by entering the data into the text filed and then clicks on yes or no to insert the entry into the document and terminate or insert the data into the document and go back and enter more data. If Yes is clicked the data is put into the document and first optYes button is made invisible and second Yes button becomes active. When no more data is needed to be entered user clciks no whcih make the OK button visible and user clicks on OK button to move data in text field to document and close the form. But when clicking on the OK button error comes up. Want to see if I can clear the Stack Space each time Yes is clicked.

fumei
06-19-2009, 10:25 AM
Have you tried googling this? (VBA + Out of Stack Space)

Have you tried using Calls to see what procedure(s) are in fact using the Stack?