Jump to content
Developer Wiki and Function Reference Links ×

Create spreadsheet folders


Recommended Posts

Hello everyone,  

          I need to create a series of spreadsheet folders, divided by project specifications, in which to store the various Sheets that are subsequently created.

I therefore created routines in creo I create the folder and then with a separator I move the sheets.

I had the scruples to check, before creating the folder, not to use a name already used for another folder (eg texture). I thought about using the command    

          i:=  GetTypeN(GetObject('tmp_s'));

but always returns 92 for all folder types.

Someone can tell me how to do it.

Thank you

Link to comment

It does not matter what the object type is. VW will not let you use the same name for multiple objects or classes. Only Layers have a separate name space.

 

So since there is a Door object, you can't name a class or a resource folder 'Door'.  Doors, DoorF, DFolder would all be OK.

 

So I think (not tested) you can just use

 

If GetObject('Name you want to use') <> Nil Then (Pseudo code create folder and move worksheets)

Link to comment

Hello everyone,    

       I couldn't find another solution so I found this solution, a bit artisanal but functioning. If the folder exists I create a test resource, and then I try to move it to the folders with the Setparentt function. If I receive an error I deduce that the folder is incorrect. If it can be useful I attach the script

 

Creation/Placement}
    proseguo:=True;
    if Not (PSuff_cartella='') THEN  {caso in cui non voglio creare una cartella}
    begin
        temp_H0:=GetObject(PSuff_cartella); {ricavo HANDLE da Nome}
        if temp_H0=NIL THEN
        begin
            NameObject(PSuff_cartella);
            BeginFolderN(ktype);
                { creo la cartella}
            EndFolder;     
            temp_H0:=GetObject(PSuff_cartella); {ricavo HANDLE da Nome cartella}
        end ELSE
        BEGIN  {Controllo che la cartella esistente sia dello stesso tipo della risorsa da creare}
            nomefoglio:=Concat('Test_',date(1,1));
            tempHandle := CreateWS(nomefoglio,1,3); 
            temp_b := SetParent(tempHandle, temp_H0); {sposto il foglio nella cartella }
            DelObject(tempHandle);
            nomefoglio:='';
            IF temp_b=False THEN  {vuol dire che il nome della cartella è già usato da un'altra risorsa}
            BEGIN
                proseguo:=FALSE;
                AlrtDialog(concat('Esiste già una cartella "',PSuff_cartella,'" usata da altre risorse modificare Parametro !!!'));
            end;
        end;
    end;

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...