Greetings All, Actually this is a VB error, but I have no idea where else I can post in this forum. Sorry about this. Below is my code and it generates error upon execution. The error message is "Run-Time Error '91': Object variable or With block variable not set" I actually have this code in my VB app called print.exe, which I place in the server. The strange thing is if my TargetFolder is pointing to my local folder in my desktop (not in the server), it works without throwing me the error message. But if my TargetFolder is "printdocs" which is the folder located in the server together with the print.exe, it return me the error message upon execution, which pointed at the line I bolded below. For your information I already granted full control for the print.exe. Private Sub Form_Load() TargetFolder = "printdocs\" Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.Namespace(TargetFolder) Set colItems = objFolder.Items For Each objItem In colItems objItem.InvokeVerbEx ("Print") Next End Sub Thank you very much Best Regards Gray d' Newbie
TargetFolder = "printdocs\" Is this a real valid path, have you tested the code with a full path ? Are you using the exact same TargetFolder = "printdocs\" on your local machine?
Thank you everyone for your help. My bad. I should use full path for the TargetFolder. Now the code is running smooth. Thank you very much. Best Regards Gray d' Newbie