Size of document doesn't change after deleting Doc Variables.

A

Ahmad

I have created 4 document variables into Word document and noted the
file size. then i deleted all the document variables. and then again
noted the file size. but unfortunately there is no change in the file
size. I used the following code to view the variables and then deleted
them.

Dim Response
Dim myVar As Variable

For Each myVar In ActiveDocument.Variables
Response = MsgBox("The document variable: " & myVar.Name & vbCr &
_
"Value: " & myVar.Value & vbCr & vbCr & _
"Do you want to delete the variable from this document?",
vbYesNo)

If Response = "6" Then
' Delete the variable.
myVar.Delete
Else
End
End If
Next myVar

MsgBox "There are no variables in the document."

so is there any body to let me know where the problem lies.
Thanks

Ahmad
 
A

Ahmad

Thanks Jezebel!
Actually it is a problem for me. coz i am storing Large amount of
binary data inside the document variables. It so happened that i
created an empty doc file. its size was about 10 to 15KB then i stored
a number of variables containing binary data. and size increased to
2.08MB. then after that i deleted all the variables stored by me. but i
was shocked that the file size was not reduced even a single byte. so
this is actually a big problem for me.

Ahmad
 

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