The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Searching for empty worksheets

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
alex_eagle Posted - 07/25/2003 : 04:02:15 AM
I want to check for empty worksheets in a folder and delete them ?
How is this done best with a Labtalk Script.
I use Origin 7
Thanks


1   L A T E S T    R E P L I E S    (Newest First)
rlewis Posted - 07/25/2003 : 09:26:05 AM
Compile and link the OriginC functions below then issue the command DestroyEmptyWorksheets() ... it works for me ...


void WksDeleteIfEmpty(string WksName)
{
/*
Deletes a named Worksheet if it is empty
*/
Worksheet Wks;
if (Wks.Attach(WksName))
{
if(Is_Worksheet_Empty(WksName)==1)
{
Wks.Destroy();
return;
}
}
}

int Is_Worksheet_Empty(string WksName)
{
/*
Determines whether a named worksheet is empty.
returns 1 (Worksheet empty)
0 (Worksheet not empty)
-1 (Invalid Worksheet, WksName)
*/
Worksheet Wks;
if (Wks.Attach(WksName))
{
int LowRange, HighRange;
foreach (Column WksColm in Wks.Columns)
{
WksColm.GetRange(LowRange, HighRange);
if(HighRange>-1) return (0);
}
return (1);
}
return (-1);
}


void DestroyEmptyWorksheets(void)
{
/*
Deletes all empty worksheet in project ..
*/
Collection <WorksheetPage> wPg;
wPg=Project.WorksheetPages; // All Worksheets in a project
foreach (WorksheetPage wksItem in wPg)
{
WksDeleteIfEmpty(wksItem.GetName());
}
}

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000