|
Hi, I need help looking for the code to send an image via the bot
|
|
|
|
|
The only code you get is the code YOU WRITE.
There's never just one way to do something in code.
|
|
|
|
|
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.
Sub ChangeColorWithReplace()
Selection.Find.ClearFormatting
Selection.Find.Font.Color = wdColorRed
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Color = -603914241
With Selection.Find
.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
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
modified 9-Nov-20 12:18pm.
|
|
|
|
|
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
Sub EditFindLoopExample()
Dim c As Collection
Set c = New Collection
With ActiveDocument.Content.Find
.ClearFormatting
.Font.Color = wdColorRed
Do While .Execute(Forward:=True, Format:=True) = True
With .Parent
If .End = ActiveDocument.Content.End Then
Exit Do
Else
c.Add .Text
End If
End With
Loop
End With
Dim s As Variant
For Each s In c
Debug.Print s
Next
End Sub Here is the link to the Microsoft Support example [^] this was based on -
|
|
|
|
|
Hello All
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
|
|
|
|
|
Step 1: Stop using VB6 and migrate to .NET.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Dear Friends,
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:
Imports System
Imports System.IO
Imports System.IO.Ports
Imports System.Text
Imports System.Threading
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)
SerialPort1.Open()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
SerialPort1.Close()
End Sub
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 10
value = SerialPort1.ReadByte()
Label1.Text += value.ToString("x2") + " "
Next
End Sub
I'm receiving that :
03 01 01 A4 A5 B2 00 00 03 00 FC
But as from the device datasheets I must receive:
03 01 01 A4 A5 B2 01 00 03 00 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).
Thanks in advance
Maurizio
modified 6-Nov-20 11:26am.
|
|
|
|
|
Compile error:
User-defined type no defined
What causes this error?
|
|
|
|
|
|
There's no class called "ComboItem" defined in the .NET Framework, and apparently not in your own code either.
Perhaps you're looking for ComboxBoxItem?
|
|
|
|
|
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:
Public Class Form1
Private WithEvents Player As AxAXVLC.AxVLCPlugin2
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Player = New AxAXVLC.AxVLCPlugin2
FlowLayoutPanel1.Controls.Add(Player)
Player.playlist.add("VideoUrl")
Player.playlist.play()
End Sub
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.
|
|
|
|
|
At the same time you add the control to the panel, also assign it to a property you can reference; e.g.
public xxxx Player1 ...
Public xxxx Player2 ...
... Add( Player )
if (...)
Player1 =
else
Player2 =
etc.
That way compiler will recognize Player1 and Player2 (even though you haven't created them yet).
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
hey, Thank you very much for the reply. This will help alot.
|
|
|
|
|
You're welcome!
Once you get more than a few players, you may want to switch to an array and then use a queue for example to determine who's up next, if it's turn based.
But for 2 players, using dedicated properties makes sense.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
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".
VB-code
Module Module1
Sub Main()
Console.WriteLine("Start of Run")
Run()
Console.WriteLine("End of Run")
Console.ReadLine()
End Sub
Async Sub Run()
Dim arg = "LEET 1337"
Await Threading.Tasks.Task.Run(Function() Foo(arg))
End Sub
Sub Foo(ByVal asdf As String)
Console.WriteLine("Start of Foo")
Threading.Thread.Sleep(5000)
Console.WriteLine(asdf)
Console.WriteLine("End of Foo")
End Sub
End Module
C#-code
using System;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Start Run");
Run();
Console.WriteLine("End of Run");
Console.ReadLine();
}
static async void Run()
{
var arg = "LEET 1337";
await Task.Run(() => Foo(arg));
}
static void Foo(string asdf)
{
Console.WriteLine("Start Foo");
Thread.Sleep(5000);
Console.WriteLine(asdf);
Console.WriteLine("End of Foo");
}
}
}
|
|
|
|
|
|
Of course I have to switch Function() to Sub()
Thank you for the correction!
|
|
|
|
|
Hi sir,
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..
|
|
|
|
|
kerek2 wrote: it running but when to insert into Oracle database 11g R2 it fail.
Define "it fail".
|
|
|
|
|
It fail means : cannot insert into Oracle database table. i'm suspect configuration for oracle in my server...any one can guide me plzz..tq
|
|
|
|
|
There's only about two dozen things that can be wrong and without any error messages and the code you're using to insert into the database, it's pretty much impossible to tell you what's going wrong.
|
|
|
|
|
Does it connect to the Oracle DB?
|
|
|
|
|
Yup using Oracle Client 11gR2
|
|
|
|
|
He was referring to your code. Does that connect to the database?
You're not supplying any information about your code and any error messages. That stuff is THE MOST IMPORTANT pieces of information you can supply to get any help from anyone on this.
|
|
|
|
|
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.
For Each proc As Process In Process.GetProcesses
If proc.ProcessName.Contains("testApp") = True Then
Debug.WriteLine("application is running")
End If
Next
already tried
For Each proc As Process In Process.GetProcesses
If proc.ProcessName.Contains("testApp") = True Then
Dim proccount As String = proc.ProcessName.Contains("testApp")
If proccount.Count >= 1 Then
Debug.WriteLine("application is already running")
End If
End If
Next
Well thats not how it works.
|
|
|
|