Getting "Object Variable or With Block Variable not set" error
Why are you wanting an new instance of the excel application?
Dim a As Excel.Application
You never create the instance. So it does not know what a is. You can
probably just remove the a...
Dim wbk As Workbook
For Each wbk In Workbooks
MsgBox wbk.Name
Next wbk
--
HTH...
Jim Thomlinson
"Suraj" wrote:
Hi,
I am getting the error "Object Variable or With Block Variable not set"
when I try to execute following VBA code.
Dim a As Excel.Application
Dim wb As Workbook
For Each wb In a.Workbooks
wb.Save
Next wb
Please let me know what is the problem
Thanks,
suraj
|