search
HomeSoftware TutorialOffice SoftwareVBA applies keyword J to batch modify the colors of multiple CAD texts

用vba批量修改多个cad文字颜色每个cad文字搜索关键字 J

Use vba to batch modify multiple cad text colors and search keywords for each cad text J hh4232

Sub txtGSssssssssssss()

'On Error Resume Next

Dim sSet As AcadSelectionSet, eV As AcadText, i

Dim tj1() As Integer, tj2() As Variant

ReDim tj1(0), tj2(0): tj1(0) = 0: tj2(0) = "Text"

Set sSet = ThisDrawing.SelectionSets.Add("pl1")

sSet.Select acSelectionSetPrevious, , , tj1, tj2 'Selected

'sSet.Select acSelectionSetAll, , , tj1, tj2 'Select all

For Each eV In sSet 'Loop in the selection set

If InStr(eV.TextString, "J") > 0 Then eV.color = acRed

Next

sSet.Update

sSet.Delete

End Sub

Color transformation in VBA programming

1. First, please download the VBA timer control online and put the ".ocx" file in it to the C drive-windows-system32 folder, then start-run-"regsvr32 VBAtimer.ocx"-OK (note : It is assumed here that the OCX file you download is named "VBAtimer.ocx").

2. Then open excel, create a form according to your own needs, then right-click on the toolbar - "Additional Controls" - find the VBAtimer control you just installed and draw a timer control anywhere on the form.

3. Then right-click on the newly created form - "View Code" and enter the following code:

Private Sub CommandButton1_Click()

UserForm1.Label1.Font.Bold = True

UserForm1.Label1.Font.Italic = True

Timer1.Interval = 500

Timer1.Enabled = True

End Sub

Sub timer1_timer()

Dim a As Long, b As Long, c As Long

Randomize

a = Int(256 * Rnd )

b = Int(256 * Rnd )

c = Int(256 * Rnd )

UserForm1.Label1.ForeColor = RGB(a, b, c)

End Sub

Private Sub CommandButton2_Click()

UserForm1.Label1.Font.Bold = False

UserForm1.Label1.Font.Italic = False

Timer1.Enabled = False

End Sub

4. Finally, double-click Thisworkbook on the project management window and enter the following code in the pop-up code box:

Private Sub Workbook_Open()

UserForm1.Show

End Sub

5. Attachment: If you don’t know how to do steps 2, 3, and 4, complete the first step and leave your email address with me.

The above is the detailed content of VBA applies keyword J to batch modify the colors of multiple CAD texts. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:Excel办公网. If there is any infringement, please contact admin@php.cn delete
Excel CONCATENATE function to combine strings, cells, columnsExcel CONCATENATE function to combine strings, cells, columnsApr 30, 2025 am 10:23 AM

This article explores various methods for combining text strings, numbers, and dates in Excel using the CONCATENATE function and the "&" operator. We'll cover formulas for joining individual cells, columns, and ranges, offering solutio

Merge and combine cells in Excel without losing dataMerge and combine cells in Excel without losing dataApr 30, 2025 am 09:43 AM

This tutorial explores various methods for efficiently merging cells in Excel, focusing on techniques to retain data when combining cells in Excel 365, 2021, 2019, 2016, 2013, 2010, and earlier versions. Often, Excel users need to consolidate two or

Excel: Compare two columns for matches and differencesExcel: Compare two columns for matches and differencesApr 30, 2025 am 09:22 AM

This tutorial explores various methods for comparing two or more columns in Excel to identify matches and differences. We'll cover row-by-row comparisons, comparing multiple columns for row matches, finding matches and differences across lists, high

Rounding in Excel: ROUND, ROUNDUP, ROUNDDOWN, FLOOR, CEILING functionsRounding in Excel: ROUND, ROUNDUP, ROUNDDOWN, FLOOR, CEILING functionsApr 30, 2025 am 09:18 AM

This tutorial explores Excel's rounding functions: ROUND, ROUNDUP, ROUNDDOWN, FLOOR, CEILING, MROUND, and others. It demonstrates how to round decimal numbers to integers or a specific number of decimal places, extract fractional parts, round to the

Consolidate in Excel: Merge multiple sheets into oneConsolidate in Excel: Merge multiple sheets into oneApr 29, 2025 am 10:04 AM

This tutorial explores various methods for combining Excel sheets, catering to different needs: consolidating data, merging sheets via data copying, or merging spreadsheets based on key columns. Many Excel users face the challenge of merging multipl

Calculate moving average in Excel: formulas and chartsCalculate moving average in Excel: formulas and chartsApr 29, 2025 am 09:47 AM

This tutorial shows you how to quickly calculate simple moving averages in Excel, using functions to determine moving averages over the last N days, weeks, months, or years, and how to add a moving average trendline to your charts. Previous articles

How to calculate average in Excel: formula examplesHow to calculate average in Excel: formula examplesApr 29, 2025 am 09:38 AM

This tutorial demonstrates various methods for calculating averages in Excel, including formula-based and formula-free approaches, with options for rounding results. Microsoft Excel offers several functions for averaging numerical data, and this gui

How to calculate weighted average in Excel (SUM and SUMPRODUCT formulas)How to calculate weighted average in Excel (SUM and SUMPRODUCT formulas)Apr 29, 2025 am 09:32 AM

This tutorial shows you two simple ways to calculate weighted averages in Excel: using the SUM or SUMPRODUCT function. Previous articles covered basic Excel averaging functions. But what if some values are more important than others, impacting the f

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.