Disk is full error message from out of nowhere

R

Robert S.

Hi,

I have a Word 2002 document which is pretty long, about 15
pages of field forms and drop down menu's etc. There is a
lot of VBA associated with the document.

The problem is, that for some unknown reason after a user
fills out the form, the following message pops up:

"The disk is full. Free some space on this drive, or save
the document on another disk."

The user did not click save, but I suppose an auto-save
feature may have attempted to do so.

What could be the source of this error? Since my VBA code
was long, and all in "ThisDocument" I broke up each
SubRoutine and placed it its own Module. This did not
solve the problem. No other errors occurs while the user
is filling out the app.

This error has been repeated on several other computers,
and I have been present when it happened. When I do the
same thing to the Word Document on my computer, I do not
get that error message.

All help, is very much appreciated.
 
P

per age

This error occurs because Word looses some of its strange
references. Mostly its own tmp files I believe. Try this
code before yoy try to save the document:

Public Sub CheckReference()

Dim vbProj As VBProject ' This refers to your VBA
project.
Dim chkRef As Reference ' A reference.

On Error GoTo error_checkreference
'UpdateVBAExecute

' Refer to the activedocument's VBA project.
Set vbProj = ActiveDocument.VBProject

' Check through the selected references in the
References dialog box.
For Each chkRef In vbProj.References

' If the reference is broken, send the name to the
Immediate Window.
If chkRef.IsBroken Then
Debug.Print chkRef.Name
' If MsgBox("Vil du slette referansen til filen
som er ødelagt?" & vbCrLf & _
' chkRef.Name, vbYesNo, "Slette manglende
referanse") = vbYes Then
' vbProj.References.Remove chkRef
' End If
LoggToFile ActiveDocument.Name, chkRef.Name
vbProj.References.Remove chkRef
End If

Next
exit_checkref:
Exit Sub
error_checkreference:
MsgBox "Yoy are not permitted to change the VBA
project, contact Help desk", 64, "Conatct Helpdesk"
Resume exit_checkref
End Sub
 
R

Robert S.

Thanks for the replies.

I've been able to pinpoint which macros seem to be the
start of this error. I have a lot of tables where the user
fills in number (eg. sales and revenues) and I made a
calculate macro which calculates the necessary fields.

Below are two separate calculate macros (either one could
be the cause of the problem.

============================================
' MACRO #1
Sub CalculateForeignPayroll()
Dim nRow As Integer
Dim num As Single
Dim payroll As Single
Dim count As Single
Dim i As Integer

payroll = 0
count = 0

nRow = ActiveDocument.Tables(9).Rows.count
For i = 1 To nRow Step 4
If ActiveDocument.Tables(9).Cell(i + 2,
2).Range.FormFields(1).Result = "" Then
num = 0
Else
num = ActiveDocument.Tables(9).Cell(i + 2,
2).Range.FormFields(1).Result
payroll = payroll + num
End If
If ActiveDocument.Tables(9).Cell(i + 3,
2).Range.FormFields(1).Result = "" Then
num = 0
Else
num = ActiveDocument.Tables(9).Cell(i + 3,
2).Range.FormFields(1).Result
count = count + num
End If
Next i

ActiveDocument.FormFields("PayrollForeignT").Result =
payroll
ActiveDocument.FormFields("EmployeeForeignT").Result =
count

End Sub
===============================================
' MACRO #2
Sub CalculateVehicles()

Dim TempNum As Single
Dim TotalNum As Single
Dim i As Integer
Dim x As Integer
Dim nRow As Integer
Dim nCol As Integer

nRow = 4

For i = 1 To 6
TempNum = 0
TotalNum = 0
For x = 2 To 5
If ActiveDocument.Tables(12).Cell(nRow,
x).Range.FormFields(1).Result <> "" Then TempNum =
ActiveDocument.Tables(12).Cell(nRow, x).Range.FormFields
(1).Result Else TempNum = 0
TotalNum = TotalNum + TempNum
Next x
ActiveDocument.Tables(12).Cell(nRow,
6).Range.FormFields(1).Result = TotalNum
nRow = nRow + 1
Next i

nRow = 11

For i = 1 To 5
TempNum = 0
TotalNum = 0
For x = 2 To 5
If ActiveDocument.Tables(12).Cell(nRow,
x).Range.FormFields(1).Result <> "" Then TempNum =
ActiveDocument.Tables(12).Cell(nRow, x).Range.FormFields
(1).Result Else TempNum = 0
TotalNum = TotalNum + TempNum
Next x
ActiveDocument.Tables(12).Cell(nRow,
6).Range.FormFields(1).Result = TotalNum
nRow = nRow + 1
Next i

For i = 2 To 6
TempNum = 0
TotalNum = 0
For x = 4 To 9
If ActiveDocument.Tables(12).Cell(x,
i).Range.FormFields(1).Result <> "" Then TempNum =
ActiveDocument.Tables(12).Cell(x, i).Range.FormFields
(1).Result Else TempNum = 0
TotalNum = TotalNum + TempNum
Next x

For x = 11 To 15
If ActiveDocument.Tables(12).Cell(x,
i).Range.FormFields(1).Result <> "" Then TempNum =
ActiveDocument.Tables(12).Cell(x, i).Range.FormFields
(1).Result Else TempNum = 0
TotalNum = TotalNum + TempNum
Next x
ActiveDocument.Tables(12).Cell(17, i).Range.FormFields
(1).Result = TotalNum

Next i

End Sub
======================================

I'm not sure why either of these would cause a problem.
Thanks for your help.
 
J

Jezebel

Nothing leaps out from your macros except that they will fail (with more
explicit error messages, I would have thought) if the tables have merged or
split cells. They would also be a great deal more readable if you used With
.... End With constructions.

With ActiveDocument.Tables(9)
nRows = .Count

etc
 
R

Robert S.

Nope, no merged or split cells.

I will try to clean up the code though, maybe that will
help.
 
R

Robert S.

I found the solution. Please see my post entitled "Make
sure your references exist!"

Thanks for all that helped.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top