View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jim Jim is offline
external usenet poster
 
Posts: 615
Default Error 28 out of stack space

I'm doing the simplest task - to fill a cell with a ctrl+a key with the
following code:

Sub PrintName()
'
' PrintName Macro
' Print Waterbury
' Keyboard Shortcut: Ctrl+a
'
ActiveCell.FormulaR1C1 = ""
Range("A1:D1").Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Application.CommandBars("Stop Recording").Visible = False
Application.CommandBars("Task Pane").Visible = False
ActiveCell.FormulaR1C1 = "Waterbury"
Range("C2").Select
Application.Run "PERSONAL.XLS!PrintName" 'it stops here
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Monty\My Documents\Book1.xls",
FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False
ActiveWindow.Close
Workbooks.Add
End Sub
It stops at line -Application.Run "Personal.XLS!PrintName" and highlights it
yellow. I get a run-time error 28: Out of stack space. It seems to be in a
continuous loop until it runs out of memory.
Any hints appreciated.