hunko
06-18-2013, 01:15 AM
Hi all!
I would like to ask if anybody can help me to solve an "Invalid qualifier" issue in VBA. I wrote a simple code for all opened .xlsm files in a specific directory to be closed. When running the macro a Compile Error: "Invalid qualifier" pops up and bold red line become highlighted.
Can anybody give an advice what´s wrong and what should be done about it?
Thanks in advance!
Sub excel2010_close_all(control As IRibbonControl)
Dim MyFolder As String
Dim MyFile As String
MyFolder = "c:\XXX\YYY"
MyFile = Dir(MyFolder & "\*.xlsm")
While MyFile <> ""
If MyFile.Open = True Then
MyFile.Close False
End If
Wend
End Sub
I would like to ask if anybody can help me to solve an "Invalid qualifier" issue in VBA. I wrote a simple code for all opened .xlsm files in a specific directory to be closed. When running the macro a Compile Error: "Invalid qualifier" pops up and bold red line become highlighted.
Can anybody give an advice what´s wrong and what should be done about it?
Thanks in advance!
Sub excel2010_close_all(control As IRibbonControl)
Dim MyFolder As String
Dim MyFile As String
MyFolder = "c:\XXX\YYY"
MyFile = Dir(MyFolder & "\*.xlsm")
While MyFile <> ""
If MyFile.Open = True Then
MyFile.Close False
End If
Wend
End Sub