Helo, acording to this code (In Visual Basic for word):
The code works for me, but it is not what I want...
The problem is: I only wont to select a colored text (example -> A text colored in Red), selecting all the words colored by Red.
I am very frustrated because I have tried everything but it does not work for me.
My goal is taking that colored text to another word document. The most important colored text i have in the document is colored in blue sky.
Sorry for the writing and thank you for your trouble.
//Replace text color//
Selection.Find.Font.Color = wdColorRed
Selection.Find.Replacement.Font.Color = -603914241
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchByte = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
The code you have shared works perfectly - it finds all text coloured red and replaces it with blank. Which according to the "comment" in the code, and the title of your post, is what it is meant to do.
If you want to get a collection of all of the text in red to do something else with it then try something like this
'Based on example from Microsoft Support'https://support.microsoft.com/en-gb/help/306338/sample-macro-that-uses-a-loop-to-find-text-in-word-documentsDim c As Collection
Set c = New Collection
.Font.Color = wdColorRed 'Search for red text'Loop through all red text one item at a timeDoWhile .Execute(Forward:=True, Format:=True) = TrueWith .Parent
If .End = ActiveDocument.Content.EndThenExitDoElse
EndIfEndWithLoopEndWith'Collection c now contains all the text in red'<<<< replace from here with paste to another document >>>>>Dim s AsVariantForEach s In c
i am using vb6 source code for sending sms via gsm modem but problem occurs when Mobile set is changed now i want to use HSDPA usb device but problem is that message seam to be sent but recipient does not receive message
i am using AT commands please help me
I'm writing you to try to solve a problem,I'm sending some hex value using a serial port to an external device.
It answer to my status request , but instead to show the value of 0x01 in the middle of the data packet it show 0x00.
I'm using a simple vb.net winform on VS2012.
Here the code i'm using:
Public Class Form1
Dim value As Byte
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
SerialPort1.Encoding = System.Text.Encoding.GetEncoding(1252)
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim array(6) As Byte
array(0) = &H3
array(1) = &H1
array(2) = &H1
array(3) = &HA4
array(4) = &HA5
array(5) = &HB2
SerialPort1.Write(array, 0, array.Length)
Label1.Text = ""
For i = 0 To 10value = SerialPort1.ReadByte()
Label1.Text += value.ToString("x2") + " "
I'm receiving that :
030101 A4 A5 B2 00000300 FC
But as from the device datasheets I must receive:
030101 A4 A5 B2 01000300 FC
Using a port sniffer I see that the device answer correctly with the value of 0x01.
Somebodys has an idea why from my application I read the byte 6 as 0x00 and not 0x01?
The problem seems to be only with the value 0x00 and 0x01 ....others value are readed correctly(I suppose).
I successfully added controls to my FlowLayoutPanel but they are not named(see code snipped).
This does not work
Player.name = "Player" & +1
So far this works:
PrivateWithEvents Player As AxAXVLC.AxVLCPlugin2
PrivateSub Button1_Click(sender AsObject, e As EventArgs) Handles Button1.Click
Player = New AxAXVLC.AxVLCPlugin2
'each click adds a new player but the name is "Player" for all players not like "Player1, Player2..."EndSub
What do i need to do do give every new Control a name?
and how can i mention them like player1 gets this URL and player2 gets an other URL?
player1.playlist.a... wont work because player1 is not declared.
I need to call a method (returning void) in an async method.
I have problem with the syntax of the Task.Run() in VB.
I have a working example in C#.
So it's just another: "Parse-this-line-from-C#-into-VB-and-it-should-work".
Console.WriteLine("Start of Run")
Console.WriteLine("End of Run")
Dim arg = "LEET 1337"Await Threading.Tasks.Task.Run(Function() Foo(arg)) ' This line fails...EndSubSub Foo(ByVal asdf AsString)
Console.WriteLine("Start of Foo")
Console.WriteLine("End of Foo")
staticvoid Main(string args)
Console.WriteLine("End of Run");
var arg = "LEET 1337";
await Task.Run(() => Foo(arg)); // This line works.
staticvoid Foo(string asdf)
Console.WriteLine("End of Foo");
i'm already developement console application using vb.net 2010 and run smoothly in windows 10 / 7 desktop.
Unfortunately when install this console application on my Windows Server 2008 , it running but when to insert into Oracle database 11g R2 it fail.
Already install oracle client 32 / 64 bit on server, when i try to connect using ODBC Administrator it can be done... anyone got idea how to settle this issues? ..
thank you in advance..
So im trying to see if a process is running 2 or more times. So far i can get a boolean if the proccess exists.
ForEach proc As Process In Process.GetProcesses
If proc.ProcessName.Contains("testApp") = TrueThen
Debug.WriteLine("application is running")
ForEach proc As Process In Process.GetProcesses
If proc.ProcessName.Contains("testApp") = TrueThenDim proccount AsString = proc.ProcessName.Contains("testApp")
If proccount.Count >= 1Then
Debug.WriteLine("application is already running")
If you are looking for restricting to single instance:
Go to project properties -> application -> Check mark "Make single instance application"
About your approach/ask above, to find all the instances of the process: [http://msdn.microsoft.com/en-us/library/z3w4xdc9.aspx](http://msdn.microsoft.com/en-us/library/z3w4xdc9.aspx)
' Get the current process. You can use currentProcess from this point' to access various properties and call methods to control the process.Dim currentProcess As Process = Process.GetCurrentProcess()
' Get all processes running on the local computer.Dim localAll As Process() = Process.GetProcesses()
' Get all instances of Notepad running on the local computer.' This will return an empty array if notepad isn't running.Dim localByName As Process() = Process.GetProcessesByName("notepad")
' Get a process on the local computer, using the process id.' This will throw an exception if there is no such process.Dim localById As Process = Process.GetProcessById(1234)
' Get processes running on a remote computer. Note that this' and all the following calls will timeout and throw an exception' if "myComputer" and 184.108.40.206 do not exist on your local network.' Get all processes on a remote computer.Dim remoteAll As Process() = Process.GetProcesses("myComputer")
' Get all instances of Notepad running on the specific computer, using machine name.Dim remoteByName As Process() = Process.GetProcessesByName("notepad", "myComputer")
' Get all instances of Notepad running on the specific computer, using IP address.Dim ipByName As Process() = Process.GetProcessesByName("notepad", "220.127.116.11")
' Get a process on a remote computer, using the process id and machine name.Dim remoteById As Process = Process.GetProcessById(2345, "myComputer")
Dim myProcess AsNew MyProcess()