Create/Copy folder via automation using job queue.

Hi All,

I create one code unit for create automatic folder and copy data in subfolder. That codeunit work fine when i call that codeuint in page via button click but when i set same codeunit in job queue it give error like this

Microsoft Dynamics NAV

The automation variable has not been instantiated.

OK

Here i paste what i write in my code unit

This code for create folder. Move1 is automation variable (‘Microsoft Scripting Runtime’.FileSystemObject). Here R drive is shared drive.

MyPath := ‘’;
MyPath := ‘R:\NAVISION Report\QA\Daily\Shipment Monitoring’+FORMAT(Month);
CLEAR(Move1);
IF GUIALLOWED THEN
IF ISCLEAR(Move1) THEN
CREATE(Move1,FALSE,TRUE);
IF NOT Move1.FolderExists(MyPath) THEN
Move1.CreateFolder(MyPath);

This code for Copy Folder

MyPath := ‘’;
TextPath := ‘’;
MyPath := ‘D:\SummaryReport\QA Daily’;
TextPath := ‘R:\NAVISION Report\QA\Daily\Shipment Monitoring\June 15’+ FORMAT(Prefix);
//TextPath := ‘R:\NAVISION Report\QA\Daily\Shipment Monitoring’+FORMAT(Month)+’’+ FORMAT(Prefix);
CLEAR(Move1);
IF GUIALLOWED THEN
IF ISCLEAR(Move1) THEN
IF GUIALLOWED THEN
CREATE(Move1,FALSE,TRUE);
Move1.CopyFolder(MyPath,TextPath);

Please suggest .

Thank you.