Jump to content

Sote WS Name in Cell


Recommended Posts

This script was generated from a request in another forum. As written is stores the Name of the worksheet resource (as shown in the resource browser) into cell B1 of ever worksheet that has an image in the file.

Procedure WorksheetNameToCell;

{Inserts the current name of the worksheet resource in a cell}
{for each worksheet visible in the drawing.}
{The CRow and CCol constants define what cell the naem is stored in.}
{The Criteria in the ForEachObject call can be modified to limit}
{the worksheets affected. Otherwise every visible worksheet will be touched.}


{July 24,2015}
{© 20015, Pat Stanford pat@coviana.com}
{Licensed under the GNU Lesser General Public License}
{No warranty expressed or implied. Use at your own risk}

Const	CRow=1; {Row to store name}
	CCol=2; {Column to store name. Column B=2}

Procedure SetCell(H1:Handle);
Var	H2:Handle;
S1:String;

Begin
	H2:=GetWSFromImage(H1);
	If H2<>Nil then
		Begin
			S1:=GetName(H2);
			SetWSCellFormula(H2,CRow,CCol,CROW,CCOL,S1);
			RecalculateWS(H2);
			ResetObject(H2);
			ResetObject(H1);
		End;
End;

Begin
ForEachObject(SetCell,((T=WORKSHEET)));
End;

Run(WorksheetNameToCell);

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...