Jump to content
Sign in to follow this  
Pat Stanford

Find & Replace in Worksheet

Recommended Posts

The following script will do a substring find and replace in the active worksheet. It is preliminary, basic code with no error checking. It does not even check to see if you have a worksheet open. Yes, the worksheet does have to be open for editing before you run the script.

If there is enough interest, I may be willing to put some bells and whistles (like a single dialog box for the data entry). that would make it a little nicer.

{*********** Copy below this line ************}

Procedure FindandReplaceInWorksheet;

{This procedure gives two dialog boxes in the first enter the substring you want to search the}

{selected portion of a worksheet for. In the second, end the string you want to replace the first string with. This is highly untested code and is provided without warranty.}

{? 2009, Coviana, Inc - Pat Stanford pat@coviana.com}

{Licensed unde the GNU Lesser General Public License}


S1,S2,S3 :String;

N1 ,N2,N3,N4,N5,N6,N7 :Integer;

H1 :Handle;


S1:=StrDialog('Enter Substring to Find','Loc1');

S2:=StrDialog('Enter Substring to Replace With', 'Loc2');



For N5:=N1 to N3 do


For N6:=N2 to N4 do




If N7 <> 0 then











{*********** and above this line ***************}

Share this post

Link to post

This is a nice example of something that I did not know we could do.

"Vectortasks: where a dream you dare to dream really can come true."

Thanks Pat!

Share this post

Link to post


Thanks again mate - just tried it and it appears to work well

What a great little tool - will save me hours and hours and hours - you cannot imagine how much time I will save

Will continue to check it and test it

thanks mate


Share this post

Link to post

The scripting language in Vectorworks is called Vectorscript.

It is a derivative of Pascal. If you have never programmed before, I would start with a book on Pascal and do some simple programs there to get an idea of how the language works.

If you have programmed in some language before I would read the Vectorscript Language Guide that is included in the Vectorworks help.

Reading the threads in this forum will give you some ideas about what you can and can't do in VS. You should also read the Customization--Vectorworks Vectorscript forum for more information. That is also one of the best places to post questions on Vectorscript.

Don't be afraid to ask questions. We will be glad to help.

Share this post

Link to post

Thanks very much for this Pat, very useful straight out of the box! And if you were going to add some bells and whistles I for one would be very keen - as long as it was compatible with VW2012

Share this post

Link to post

Nice and simple, Thanks

However it doesn't seem to do record fields for me. Is that by intent or am I off somewhere?

Share this post

Link to post

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.

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.

Sign in to follow this  


7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114


© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

  • Create New...