ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can't compile, module empty? (https://www.excelbanter.com/excel-programming/333191-cant-compile-module-empty.html)

davegb

Can't compile, module empty?
 
I've copied a macro from here and modified it for my situation. I want
to open each file in the "Base" directory, run "SPSSClean" on it, the
save it to the "Mod" directory.

Sub MoveandClean()
Dim strDirBase, strDirMod, strFName As String

strDirBase = "H:\My Documents\Jenise M\PIP Drilldown\SFY 05 Q2\Base"
strDirMod = "H:\My Documents\Jenise M\PIP Drilldown\SFY 05 Q2\Mod"
strFName = Dir(strDirBase)

Do Until strFName = ""

Workbooks.Open strDirBase & strFName ', True, False

Call SPSSClean

ActiveWorkbook.SaveAs Filename:=strDirMod & "\" & strFName &
"mod"
ActiveWorkbook.Close
strFName = Dir()
Loop

End Sub

The macro does nothing. It gets to "do until strFName = "", then skips
to end sub. Doesn't see the files at all. A watch on strFName says
"Can't compile, Module empty". What does module empty mean? Obviously,
there's something in the module.
Any suggestions?
Thanks all.


davegb

Can't compile, module empty?
 
The correct error message is "cant compile module". The empty is the
next field in the Watch window


Tom Ogilvy

Can't compile, module empty?
 
from this immediate window:

? dir("C:\data5")
< this returns nothing
? dir("C:\data5\")
5B_73_TOFL.xls

so try puting a "\" on the end of strDirBase

better, try putting a "\*.xls" on the end
--
Regards,
Tom Ogilvy

"davegb" wrote in message
oups.com...
I've copied a macro from here and modified it for my situation. I want
to open each file in the "Base" directory, run "SPSSClean" on it, the
save it to the "Mod" directory.

Sub MoveandClean()
Dim strDirBase, strDirMod, strFName As String

strDirBase = "H:\My Documents\Jenise M\PIP Drilldown\SFY 05 Q2\Base"
strDirMod = "H:\My Documents\Jenise M\PIP Drilldown\SFY 05 Q2\Mod"
strFName = Dir(strDirBase)

Do Until strFName = ""

Workbooks.Open strDirBase & strFName ', True, False

Call SPSSClean

ActiveWorkbook.SaveAs Filename:=strDirMod & "\" & strFName &
"mod"
ActiveWorkbook.Close
strFName = Dir()
Loop

End Sub

The macro does nothing. It gets to "do until strFName = "", then skips
to end sub. Doesn't see the files at all. A watch on strFName says
"Can't compile, Module empty". What does module empty mean? Obviously,
there's something in the module.
Any suggestions?
Thanks all.





All times are GMT +1. The time now is 12:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com