PDA

View Full Version : Error: Object Variable or With block variable not set



smrobi
03-29-2011, 12:55 AM
:(
I have found a peculiar problem. When I am using my macro directly it is working well but when I am saving it as add-ins and using the add-in later to run my micro from, I am getting the error "Object variable or with block variable is not set". I am getting the error in my code section where I wrote "ChDir "C:\"
ActiveWorkbook.SaveAs Filename:= _
"C:\HuaweiBSCAudit.xlsm", _
FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False"

Please help.

GTO
03-29-2011, 01:32 AM
I am currently using 2003 with the service pack. It seems to work for me fine, albeit I did not have the Constant.

ActiveWorkbook.SaveAs Filename:=ActiveWorkbook.Path & "\HuaweiBSCAudit.xlsm", _
FileFormat:=52, _
CreateBackup:=False
You may want to show the entire procedure.