Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Scanning Through Excel More Efficiently


Hey guys,

     I'm looking to see if there is a better way to scan through an excel sheet. Right now what I've been doing is:

Code:
For i = 1 To Worksheets(1).UsedRange.Columns.count
For j = 1 To Worksheets(1).UsedRange.Rows.count
If Worksheets(1).UsedRange.Cells(j, i).Text = "mytext" Then
count = count + 1
End If
Next j
Next i

This has proved pretty efficient for me, but there seems to always be someone who has a better way. Any takers?

 




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Getting Data From EXCEL, Efficiently
Hello all!

I have experienced a huge time delay in looping through cells in a worksheet to compare, manipulate, get... data.

So I am wondering what is the most efficient way to retrieve data from EXCEL to manipulate, store, compare, etc... without having to loop through the text?

Would it be to turn the spreadsheet into a recordset to compare to another recordset.

Essentially, that is what I am doing. I am trying to compare data from EXCEL to a recordset I retrieve from ACCESS.

Thanks for helping VB City!

Efficiently Loading Stock Price Data Into Excel
Hi everyone!

I refer to Peter's article at http://www.eggheadcafe.com/articles/20020108.asp
(quote: "The neat thing about this is that by simply changing the SQL Statement and supplying the name of ANY text file that resides in that folder, you can use the filesystem object (for example) to get a list of the files in the folder, and then read each file into a separate recordset object by simply looping through your array of stock price filenames and dynamically changing the SELECT statement to match on each iteration.")
and I'd like to ask the following:

I am looking for an efficient way to load stock price data into Excel from text files (or any other database stored locally , i.e. I'm not talking bout web queries) for testing purposes.
To be able to measure portfolio risk correctly, the data has to be loaded on a daily basis(*), one by one.

Does anyone have a sample file (e.g. for Excel VBA) which allows to learn the basics?
Would SQL, ADO or an Access database be the most appropriate solution for this?

(*) As I want to avoid recalculation of the same values (indicators, stops, risk, etc.) over and over again, I consider keeping all the calculated data in a database and calculate only one row (the newly added) in Excel.

I hope I explained everything clear enough.

I also post an excellent article on "VBA: Efficiency and Performance". - Enjoy!

Thanks for help and time.
Any help is appreciated.

Regards,
Thomas <tompf@gmx.at>

Scanning An Excel Spreadsheet From A VB App
Hello

I need to scan some Excel spreadsheet automatically in search of a particular value in a cell.

How can I "open" an xls spreadsheet from my app?

i added the excel reference components and I'm reading a lot about Worksheet, Range and Cell objects, but I still haven't found how to open and reference an .xls file

From then on I guess is just a case of nested cycling through the various collections down to the single cell until I find what I'm looking for, am I right?

Can somebody help me?

Thx

How To Do This Efficiently?
In my interface I have just finished my 2d version. I am now implementing the 3d version.(same thing but in 3 dimensions) I will basically have to use almost the same forms as I did in my 2d application but with a little modifications. So what I did is I just created new forms and copied the controls over(the text boxes and everything) and I am using new global variables to hold the variables to prevent confusion. Now I have almost 30 forms (and global variables for each form). I am beginning to get the feeling that maybe I am doing this inefficiently.. Could anyone please let me know if there is an efficient way to do this.

How Can I Efficiently Search An Array?
Hi,

I have a program which inserts numbers into an array. It first searches the array to determine if that number is already there. If the number isn't there, it will insert that number into the appropriate position in the array. The array doesn't need to be sorted at any point, because the number is inserted in numerical order, i.e. if the numbers in the array are 2,3,6,9 and the number to be inserted is 7, it will insert it between 6 and 9.

Once the array reaches a significant size - over 1000 entries say - the array searching algorithm becomes very inefficient. It searches the entire array until it finds the number, at which point it stops. Its a brute force approach and I'm sure there must be a more efficient way to do it. I suspect that an efficient algorithm would follow similar logic to a QuickSort routine (which is the fastest sorting algorithm).

Can anyone help?

Cheers.

Writing Efficiently From VBA To A Worksheet
Hi.
I’m trying to make a write operation to a worksheet as quick a possible.
I’ve made an array (one dimensional string, but I can use a Variant if necessary), and I want this to be written to a given row, staring in column A. One way to do it is too loop through the array using

Sheet(“sheet 1”).cells(row, i) = array(i)

in the loop. But as far as I know this is not the most efficient way of doing it.

I have also tried using

Sheets(“sheet 1”).range(<proper dimension>) = array

This works, but some of my array elements contain formulas, and these end up being written in the cell rather than the result of the formula (if array(0) contains (“=Sum(A1:A2)” then that text will appear in the cell rather then the sum of A1 and A2).

Anyone?

Thanks for your time
-Terry

Efficiently Writing To SQL Table Using VB6
Below is a sub that I am using to write data received from a modbus connection to a PLC. I am using the data to keep a history file in a SQL database. To be of any use the data must be gathered very frequently and written in to database very often. Is there a more efficient way of writing this data to SQL than the method below. It looks like my loop times are around 11 to 12 seconds and need to be 1 to 2.



Private Sub WriteDigitalDataToSQL()

Dim ConnectionOne As ADODB.Connection
Dim rstHistory As ADODB.Recordset
Dim ConnectionString As String
Dim SQL As String
Dim i As Integer
Dim DataType As String
Dim ServerName As String
Dim Database As String
Dim Count As Integer


ServerName = "10.1.1.2"
Database = "WIG"

Set ConnectionOne = New ADODB.Connection
ConnectionString = "driver={SQL Server};server=" & ServerName & ";database=" & Database & ";UID=sa;PWD="
ConnectionOne.Open ConnectionString
Set rstHistory = New ADODB.Recordset
rstHistory.CursorType = adOpenKeyset
rstHistory.LockType = adLockOptimistic

i = 0
Count = 0

If Mod1.Result = 0 Then

Do While i < 480

DataType = "Digitals"

If chkVbDigitalTable(i).Value = 1 Then
SQL = SQL + "Insert into history values (" & "'" & Now & "'" & "," & "'" & DataType & "'," & i & "," & VisualBasicReceiveDigitalsTable(i) & ")"
Count = Count + 1
End If

i = i + 1

Loop


rstHistory.Open SQL, ConnectionOne


ConnectionOne.Close

If rtbLog.Text = "" Then
rtbLog.Text = Now & ": " & "Added " & Count & " digital items to the history file"
Else
rtbLog.Text = rtbLog.Text & vbCrLf & Now & ": " & "Added " & Count & " digital items to the history file"
End If

Else

If rtbLog.Text = "" Then
rtbLog.Text = Now & ": No digital items written...loss of communication"
Else
rtbLog.Text = rtbLog.Text & vbCrLf & Now & ": No digital items written...loss of communication"
End If

End If


End Sub

Help With Deleting Efficiently From A Table.
Hi all
I have a program that utilises three tables. Table one is a master that is read from, table two is a temp table where only the required info is written to from the master (and data can be added to the records), and the third is for archiving. I am using an apache database with SQL. The fields from the tables are populated into an MSFlexgrid.
I basically have nine fields per record (so one row of a table). Each record can be updated during the course of it's life. The way I am updating a record (if for example I want to add the word "Completed" to a field within the record), is to delete it from the temp table, then re-insert it using info from the program:

Code:
checklist.Execute ("DELETE FROM checklisttemp_table WHERE (job_time = '" & opschecklist.Text2.Text & "' AND sys_name = '" & opschecklist.Text4.Text & "' AND job_name = '" & opschecklist.Text5.Text & "')")

checklist.Execute ("INSERT INTO checklisttemp_table (job_time, sys_name, job_name, job_status, sign_user, jobname_day)values ('" & edit.Label2.Caption & "', '" & edit.Label3.Caption & "', '" & edit.Label4.Caption & "', '" & edit.Text1.Text & "', '" & opschecklist.Text7.Text & "', '" & edit.Text2.Text & "')")
My problem is, I need a more efficient way of deleting the record before adding it again, as if I have two records that are simular, they will both be deleted.
Unless anyone can think of a better way to do this.
AArrgghh...help.......
Thanks
Lee123

Integer To Binary Efficiently
Hi,
I need to do the following as efficiently as possible:

Convert an integer to Binary and put the 1s & 0s into an array.

This is what I have so far:

Code:
' Convert decimal to binary and fill the array
intQuotient = MyInteger

Do While intQuotient > 0
intReminder = intQuotient Mod 2
intQuotient = intQuotient 2

BinaryArray(ctr) = intReminder
ctr = ctr + 1
Loop


How can I do this any faster?
Is there a function to convert Integer to Binary or something?

Getting COM Port Response Efficiently In Vb
I want to know how to catch response from COM port without delay and how to check which port is open

Normalising A Database Efficiently.
Ive written some code to normalise a database but it seems to be slow. I've look for some examples on the web and not found any. There is a wizard in access and that seems to be able to work i out pretty quickly. Where am i going wrong ?
Im sure Its just bad programming technique and my lack of knowledge.
I have one large import table of round 30000 records. plus other to import later

tbl_import_temp
Title, Artist, Brand, Format, TitleID,AristID, BrandID, FormatID

My Nomal tables are ...

tbl_titles
TitleID, Title

tbl_Artist
ArtistID, Artist

and so on.....

here is my code......

Code:Function CheckNormalForm(FieldName, TableName)
        Dim RS As New ADODB.Recordset
        Dim I As Integer
        Dim strValue As String
        Dim arrGetRows()
   
        strSQL = "SELECT DISTINCT " & FieldName & " FROM tbl_Import_Temp"
        Set RS = cn.Execute(strSQL)
        arrGetRows = RS.GetRows
        RS.Close
        For I = 0 To UBound(arrGetRows, 2) ' cycle through distinct rows
            strValue1 = arrGetRows(0, I)
            strValue = Replace(arrGetRows(0, I), "'", "''")
            strSQL = "SELECT " & FieldName & "," & FieldName & "ID FROM " & TableName & " WHERE " & FieldName & " Like '" & strValue & "'"
            Set RS = cn.Execute(strSQL)
            If RS.EOF Then ' item did not exist in normal table
                RS.Close
                RS.Open TableName, cn, adOpenDynamic, adLockOptimistic, adCmdTable
                RS.AddNew ' add the item
                RS(FieldName) = strValue1
                RS.Update
            End If
            intID = RS(FieldName & "ID") ' get its ID
            RS.Close ' put the ID in the temp import table to create relationships later
            strSQL = "Update tbl_import_temp SET " & FieldName & "ID = " & intID & " WHERE " & FieldName & " Like '" & strValue & "'"
            cn.Execute strSQL
        Next
        Set RS = Nothing
End Function

can anyone give advice on how else to do this ? We import quite a lot of flat files into this database but once a few have been done the process gets slower and slower. I want to get this faster without using SQLServer. (im on access)

Thanks

Synchronize Multiple Databases Efficiently.
4 companies: One database each. (That means 4 DB's)

They all have a table full of vendor information.

I need to check the consistency of the data in the DB's. That is, I need to make sure that every record is present in every DB. While I would be able to do this by looping through each database, reading the primary key and connecteing to each other database to compare the keys, I was wondering if anyone had any insight on a 'better' way of doing this.

Efficiently Assemble Conn In Module Help
I have a connection string public in module. and thay are working fine, code is this:

VB Code:
'in moduleOption ExplicitPublic Const STRING_1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="Public Const STRING_2 = "datadbInventory2.mdb;Persist Security Info=False;Jet OLEDB:Database Password=123;"Public Const STRING_3 = "datacashRegister2.mdb;Persist Security Info=False;Jet OLEDB:Database Password=123;"Public userpath1 As StringPublic userpath2 As StringPublic Function strString1(strUser) As StringstrString1 = STRING_1 & strUser & STRING_2 End FunctionPublic Function String1(strUser) As StringString1 = STRING_1 & strUser & STRING_2 End FunctionPublic Function strString2(strUser) As StringstrString2 = STRING_1 & strUser & STRING_3End FunctionPublic Function String2(strUser) As StringString2 = STRING_1 & strUser & STRING_3End Function 'in formPrivate Sub Form_Load()Dim TmpVal As StringDim net As StringDim loca As String TmpVal = GetSetting("protect", "server", "optserver", "True") 'this is option value If TmpVal = "True" Then  net = "\" & GetSetting("protect", "CompName", "txtserver", "") 'this return a value "\toshiba1"  'userpath1 = String1(net)  userpath2 = strString1(net)  MsgBox userpath2Else  loca = GetSetting("protect", "LocalDrive", "txtclient", "") 'this return a value "C:"  'userpath1 = String2(loca)  userpath2 = strString2(loca)  MsgBox userpath2End IfEnd Sub


1.Any one can give me more efficient way to minimize code into 2 string to use in form (example:conn1 for dbinventory2.mdb and conn2 for cashregister2.mdb)

2.after that I want to put down whole code in module into

Any replay is very much appreciate

best regards,

Efficiently Limit A File To 100 Lines
I am developing a small app that will write a line to a file fairly frequently and I'd like to guard against the file getting longer than about 100 lines. Anyone have an efficient method to do that?

Stucked---how To Write This Loop Efficiently
I have a one dimension dynamic array say, my_array(), for example, this time, it's been populated at run time as
my_array(0)=6
my_array(1)=7
my_array(2)=8

obviously, the actual value and length of array can vary at run time
I want to write a select case such as


select case my_number
case 1 to 6
'do something here...
case 7 to 13
'do something here..
case 13 to 20
'do something here...
'hope you could see the pattern here...

how do I write this more effectively and generically

Moving Shapes Efficiently - For Games
Hi there,
I've been trying to develop small games in vb like pacman, tetris etc but I think I may be moving the shapes around the form in an inefficient manner. For instance to move a shape from side of the form to the other I would write the following in a timer procedure (interval set at say 50ms):

Private Sub timer1()
  shape1.left = shape1.left + 25
End Sub

Although this works, it doesn't really make the shape move very smoothly. Is there another way that I can move a shape around on a form??

Best Way To Populate Multiple Combo Boxes Efficiently??
Hi everyone,

I have a form which is going to act as a "bulk entry" sheet for the daily work statistics of the users of my application.

It contains a picture box containing a row of controls which repeats 50 times. One of the controls is the "action" box which will be a combobox populated from a database table. Whenever I have used comboboxes like this in the past I have always populated them in the dropdown event. However as this control is repeated and the drop down action is therefore potentially repeated 50 times, it surely doesnt make sense to hit the db and populate the combo for each instance of the control that is used does it??

Can anyone suggest a more efficient/better practice way of doing this please. Should I be considering something like a disconnected recordset (I'd then only hit the db once and the data to populate each instance of the action control would already be there) or is there an even better way to do this ???

Does Windows Allocate Memory For VB Programs Efficiently?
Well, first I apologize for asking a similar question in another thread - but I feel I did not express myself well enough in that one - and this is a really important issue for me and I would really appreciate any feedback.


This started because I fired up the task manager in XP and tried to watch the memory allocation/deallocation for my program. I was not happy with what I saw (looked like my program had a memory leak) so I went through my code and made sure all of my object references were set to Nothing, when I was done with them. Then I set all my form references to nothing and I even put code in the form terminate event as an extra check that my forms were destroyed.


None of this made any difference so I started doing some experiments with very simple programs. I still noticed the following:


1.) When forms are destroyed, the memory is not freed.


2.) Message boxes result in an increase in memory usage with no corresponding decrease.


3.) In my bigger program I noticed "greedy" behavior. In other words, if I created and destroyed a bunch of objects, memory would increase and not decrease, but then if I created the objects again, memory would NOT increase. It was almost like the program was holding on to memory in case it may need it again later. I feel for a true memory leak, this would not happen - memory allocation would just keep increasing.


Does any of this make any sense? Could setting objects to Nothing in VB code not be enough? Could a system call be needed to force the program to release memory?


Could the garbage collector be on strike?


Thanks in advance.

How To Download Images Efficiently With WebBrowser Control In VB.NET?
I want to download all the images inside an HTML page. I have created a WebBrowser control; navigate to a URL; and cast the webpage as mshtml.HTMLDocument:

Code:WebBrowser.Navigate(txtURL.Text)
Dim HTMLDoc As mshtml.HTMLDocument = WebBrowser.Document

After the call to the Navigate function, all the images in that page should be downloaded. My problem is that I don't know how to extract and save the images directly from HTMLDoc. Currently I am using another way to do the task: get the image src from HTMLDoc and use Internet Transfer Control to download the images. This seems stupid since the same picture is downloaded twice.

Some early post suggested to save the whole webpage in order to get the images. But I don't want to do that, coz in the source file the ".src" attributes within the IMG tags will be changed - I want to extract some information from the original ".src" attributes.

Anyone has a solution to this? Many thanx!

Many Checkboxes To Control What Data VBA Outputs- How To Code Efficiently?
I have the following code to create headings on a worksheet based on what the user has selected. What's worse is that there is identical code that actually outputs data on the sheet. Can anyone suggest a more efficient way to do something like this?

If I could cycle through an array of checkbox values perhaps this would speed things up but even then, each if statement would be a bit different. Maybe there is someway to use bitwise AND and ORs in the if statements??

Any ideas would be appreciated- I'm guessing there are many better ways to structure this.

Thanks,

Dave



Code:
If (FormMain.ckValue) Then setCellValueAndMoveRight ("DU Angular Speed Value")
If (FormMain.ckBool) Then setCellValueAndMoveRight ("DU Angular Speed Pass/Fail")
If (FormMain.ckUSL) Then setCellValueAndMoveRight ("DU Angular Speed USL")
If (FormMain.ckLSL) Then setCellValueAndMoveRight ("DU Angular Speed LSL")

If (FormMain.ckValue) Then setCellValueAndMoveRight ("RL Angular Speed Value")
If (FormMain.ckBool) Then setCellValueAndMoveRight ("RL Angular Speed Pass/Fail")
If (FormMain.ckUSL) Then setCellValueAndMoveRight ("RL Angular Speed USL")
If (FormMain.ckLSL) Then setCellValueAndMoveRight ("RL Angular Speed LSL")

If (FormMain.ckValue) Then setCellValueAndMoveRight ("LR Angular Speed Value")
If (FormMain.ckBool) Then setCellValueAndMoveRight ("LR Angular Speed Pass/Fail")
If (FormMain.ckUSL) Then setCellValueAndMoveRight ("LR Angular Speed USL")
If (FormMain.ckLSL) Then setCellValueAndMoveRight ("LR Angular Speed LSL")

If (FormMain.ckValue) Then setCellValueAndMoveRight ("U Angle Value")
If (FormMain.ckBool) Then setCellValueAndMoveRight ("U Angle Pass/Fail")
If (FormMain.ckUSL) Then setCellValueAndMoveRight ("U Angle USL")
If (FormMain.ckLSL) Then setCellValueAndMoveRight ("U Angle LSL")

If (FormMain.ckValue) Then setCellValueAndMoveRight ("D Angle Value")
If (FormMain.ckBool) Then setCellValueAndMoveRight ("D Angle Pass/Fail")
If (FormMain.ckUSL) Then setCellValueAndMoveRight ("D Angle USL")
If (FormMain.ckLSL) Then setCellValueAndMoveRight ("D Angle LSL")

If (FormMain.ckValue) Then setCellValueAndMoveRight ("R Angle Value")
If (FormMain.ckBool) Then setCellValueAndMoveRight ("R Angle Pass/Fail")
If (FormMain.ckUSL) Then setCellValueAndMoveRight ("R Angle USL")
If (FormMain.ckLSL) Then setCellValueAndMoveRight ("R Angle LSL")

If (FormMain.ckValue) Then setCellValueAndMoveRight ("L Angle Value")
If (FormMain.ckBool) Then setCellValueAndMoveRight ("L Angle Pass/Fail")
If (FormMain.ckUSL) Then setCellValueAndMoveRight ("L Angle USL")
If (FormMain.ckLSL) Then setCellValueAndMoveRight ("L Angle LSL")

If (FormMain.ckValue) Then setCellValueAndMoveRight ("UD Running Current Value")
If (FormMain.ckBool) Then setCellValueAndMoveRight ("UD Running Current Pass/Fail")
If (FormMain.ckUSL) Then setCellValueAndMoveRight ("UD Running Current USL")
If (FormMain.ckLSL) Then setCellValueAndMoveRight ("UD Running Current LSL")

If (FormMain.ckValue) Then setCellValueAndMoveRight ("DU Running Current Value")
If (FormMain.ckBool) Then setCellValueAndMoveRight ("DU Running Current Pass/Fail")
If (FormMain.ckUSL) Then setCellValueAndMoveRight ("DU Running Current USL")
If (FormMain.ckLSL) Then setCellValueAndMoveRight ("DU Running Current LSL")

If (FormMain.ckValue) Then setCellValueAndMoveRight ("RL Running Current Value")
If (FormMain.ckBool) Then setCellValueAndMoveRight ("RL Running Current Pass/Fail")
If (FormMain.ckUSL) Then setCellValueAndMoveRight ("RL Running Current USL")
If (FormMain.ckLSL) Then setCellValueAndMoveRight ("RL Running Current LSL")

If (FormMain.ckValue) Then setCellValueAndMoveRight ("LR Running Current Value")
If (FormMain.ckBool) Then setCellValueAndMoveRight ("LR Running Current Pass/Fail")
If (FormMain.ckUSL) Then setCellValueAndMoveRight ("LR Running Current USL")
If (FormMain.ckLSL) Then setCellValueAndMoveRight ("LR Running Current LSL")

If (FormMain.ckValue) Then setCellValueAndMoveRight ("UD Inrush Current Value")
If (FormMain.ckBool) Then setCellValueAndMoveRight ("UD Inrush Current Pass/Fail")
If (FormMain.ckUSL) Then setCellValueAndMoveRight ("UD Inrush Current USL")
If (FormMain.ckLSL) Then setCellValueAndMoveRight ("UD Inrush Current LSL")

If (FormMain.ckValue) Then setCellValueAndMoveRight ("DU Inrush Current Value")
If (FormMain.ckBool) Then setCellValueAndMoveRight ("DU Inrush Current Pass/Fail")
If (FormMain.ckUSL) Then setCellValueAndMoveRight ("DU Inrush Current USL")
If (FormMain.ckLSL) Then setCellValueAndMoveRight ("DU Inrush Current LSL")

If (FormMain.ckValue) Then setCellValueAndMoveRight ("RL Inrush Current Value")
If (FormMain.ckBool) Then setCellValueAndMoveRight ("RL Inrush Current Pass/Fail")
If (FormMain.ckUSL) Then setCellValueAndMoveRight ("RL Inrush Current USL")
If (FormMain.ckLSL) Then setCellValueAndMoveRight ("RL Inrush Current LSL")

If (FormMain.ckValue) Then setCellValueAndMoveRight ("LR Inrush Current Value")
If (FormMain.ckBool) Then setCellValueAndMoveRight ("LR Inrush Current Pass/Fail")
If (FormMain.ckUSL) Then setCellValueAndMoveRight ("LR Inrush Current USL")
If (FormMain.ckLSL) Then setCellValueAndMoveRight ("LR Inrush Current LSL")

If (FormMain.ckValue) Then setCellValueAndMoveRight ("UD Stall Current Value")
If (FormMain.ckBool) Then setCellValueAndMoveRight ("UD Stall Current Pass/Fail")
If (FormMain.ckUSL) Then setCellValueAndMoveRight ("UD Stall Current USL")
If (FormMain.ckLSL) Then setCellValueAndMoveRight ("UD Stall Current LSL")

If (FormMain.ckValue) Then setCellValueAndMoveRight ("DU Stall Current Value")
If (FormMain.ckBool) Then setCellValueAndMoveRight ("DU Stall Current Pass/Fail")
If (FormMain.ckUSL) Then setCellValueAndMoveRight ("DU Stall Current USL")
If (FormMain.ckLSL) Then setCellValueAndMoveRight ("DU Stall Current LSL")

If (FormMain.ckValue) Then setCellValueAndMoveRight ("RL Stall Current Value")
If (FormMain.ckBool) Then setCellValueAndMoveRight ("RL Stall Current Pass/Fail")
If (FormMain.ckUSL) Then setCellValueAndMoveRight ("RL Stall Current USL")
If (FormMain.ckLSL) Then setCellValueAndMoveRight ("RL Stall Current LSL")

If (FormMain.ckValue) Then setCellValueAndMoveRight ("LR Stall Current Value")
If (FormMain.ckBool) Then setCellValueAndMoveRight ("LR Stall Current Pass/Fail")
If (FormMain.ckUSL) Then setCellValueAndMoveRight ("LR Stall Current USL")
If (FormMain.ckLSL) Then setCellValueAndMoveRight ("LR Stall Current LSL")

If (FormMain.ckValue) Then setCellValueAndMoveRight ("Vertical Overrun Drift Value")
If (FormMain.ckBool) Then setCellValueAndMoveRight ("Vertical Overrun Drift Pass/Fail")
If (FormMain.ckUSL) Then setCellValueAndMoveRight ("Vertical Overrun Drift USL")
If (FormMain.ckLSL) Then setCellValueAndMoveRight ("Vertical Overrun Drift LSL")

If (FormMain.ckValue) Then setCellValueAndMoveRight ("Horizontal Overrun Drift Value")
If (FormMain.ckBool) Then setCellValueAndMoveRight ("Horizontal Overrun Drift Pass/Fail")
If (FormMain.ckUSL) Then setCellValueAndMoveRight ("Horizontal Overrun Drift USL")
If (FormMain.ckLSL) Then setCellValueAndMoveRight ("Horizontal Overrun Drift LSL")



Edit by Moderator:
Please post Excel questions, in the Excel forum.

Please use the [vb][/vb] tags when you post your code. Edit or reply to this post to see how.

Thank you.

Scanning
hey all. I couldnt decide where to put this. api or here. i chose here. i know how to scan through files using the findfile api. Is there a better way.
also is there a way to scan through the registry for a specific key. Kind of like what regedit does. I think just put up a loop for regopenkey ?

Scanning
I dont know if there is a name for the action I want to do so I cant search previous threads so im sorry if this has been asked before but basically what I want to do is scan a sentence typed in by a user for specific word(s)

for example user types

"I want to pickup the knife"

It then scans through looks for the words "pickup" and "knife" and if present allow me to do something like add the knife to their inventory.

Any ideas?

(((EDIT: Also off topic I have an annoying thing thats only just started to happen when I click delete on an object on my form it doesnt delete the object, just its name. Anyone know how to switch this back cause its driving me insane

Scanning Help
This may be a complicated one for me, but i want to tackle the challenge of my next project, and i must resort for help...What i want to accomplish is making an appz that will scan my website and bring back the # of forums/topics of my board...



Edit by Iceplug: Purpose of board is to have helpful communication on the forums for public viewing - email information blocked

Scanning
I've made a little project that allows me to scan on a network, but what i have to do is bring my app up do teh scanning, then past it to what ever photo software i want to edit it in. How can i put my project in the scanner list and be able to select it as a default so if i open paintshop pro, and scan, it will bring my app up to scan with.

Scanning With XP PRO
I am using xp pro, and i don't have the kodac scanning file, what can i use to scan with?

Scanning
i am using the kodak scan ocx file to scan images with my project. but when i scan i creates a 24bit color bmp file and the image1 control won't read this , it will only read 256 color so is there a way to make it scan to only 256 color and not 24 bit

Scanning Through VB
Is it possible to scan a page through scanner(by coding) without using scanning software.

Help With My Scanning In VB?
Hi all,

I am attempting to use VB6 to automatically start the scanner.

I have found a sample project from Kodak which I have attached.

It is exactly what I want and it uses the Kodak Image Scan and Image Edit active x components which are provided in VB6 (professional and enterprise).

You can scan an image and it automatically gives it a filename - which is unique and different to the last.

i.e. SCAN0001.TIF, SCAN0002.TIF, SCAN0003.TIF etc etc

My problem is this: As soon as the scan is finished, how can I tell what the name of the new scan is? I need to do this in code.

All the scans go to the same place, but I would like to msgbox the name of the file the user has just scanned.

i.e. "You have just scanned a file, which is called SCAN0004.TIF"

Is there a way to determine in code the filename of the file that has just been scanned.

I hope this is clear and can anyone provide any advice on how to do this?

Thanks

Scanning
I would like to search for a number of files at the same time as in File exist etc, but instead of the usual listbox or msgbox if the files exist or dont exist I would like to change a graphic file that depicts the type of file that has been found.....

I have the programme more or less 100% complete apart from the searching.....

I wonder if anyone can help with this project as I can send the completed source code so that you can see what it is all about...

Steve M (JazCom)

Scanning With VB
Hi all


how do i interface scanner using VB. To my knowledge i can do it with Wan Image control but i need that scanned image should be with given resolution, format and should save automatically.

how do i do that?

help me with coding if u have

Scanning
Hi All
I want to write an application....
Question papers of students will have four answer options for
every question.
Papers will be scanned using scanner and a graphic file of
each paper will be created.
Now I want to convert these file in to data table
Student Number Question No Option No
-------------------- --------------- -------------

Is anybody have the idea to do this conversion?
Please help.
Thanks in advance

Scanning...
My setup:

PC(LPT1)---> HP 5100C Scanner --->Printer

the problem:

How do I scan a picture and collect the image? I don't really want to use the software that came with the scanner because it takes ages to load, I would rather send signals to the scanner manually (by what means I don't know) and somehow gather the data sent back. I want to enable the user to do the following:

1. load my program
2. put a magazine cover on the scanner plate
3. click a button, and wait for the scanner to finish scanning
4. specify a filename to save a thumbnail of the magazine to

Is this possible, ie is there a standard set of scanner commands out there? I have not yet been able to locate any ActiveX controls to help me with this so i thought I would make my own.

Does anyone know of any scanning OCX's ?

I'll give a free copy of the finished article to anyone that wants it, just mail me a request!

Thank you.

Scanning In VB App.
Is it possible to use a scanner ti accuire images directly into a VB app. I believe it can be done using TWAIN. Can somebody tell me how to go about it. Thanks a lot.....

Scanning
Hello,

I need to know a simple way to scan images via VB,
(e.g runnimg windows imaging or using 3D party control ,...)

THANKS in advance.

Scanning
Hello,

I need to know a simple way to scan images via VB,
(e.g runnimg windows imaging or using 3D party control ,...)

THANKS in advance.

Scanning Documents
I am using the victor library to scan images and i am looking to get my images smaller. When scanned through windows office my tiffs are 45 kb, whne doing it through my app they are 245kb? here is a sample of the code is something wrong?

Dim rcode As Long
Dim tempimage As imgdes
Dim err As Integer
Dim Result As Integer
Dim srect As RECT
Dim showUI As Long
Dim gsimage As imgdes
Dim maxpages As Long
Dim unit_data As TWAIN_CAP_DATA
Dim reso_data As TWAIN_CAP_DATA
Dim pixel_data As TWAIN_CAP_DATA
Dim bright_data As TWAIN_CAP_DATA
Dim Contrast As TWAIN_CAP_DATA
Dim strpixel As String
Dim feederIsEnabled As Long
Dim feederHasPaper As Long
Dim sourceName As String
Dim test As String
'******************
' scan quality ****
'******************
unit_data.oneValue.val = TWUN_INCHES
unit_data.conType = TWON_ONEVALUE

reso_data.oneValue.val = 150 ' 150 dpi
reso_data.conType = TWON_ONEVALUE

pixel_data.oneValue.val = TWPT_BW '1-bit b/w
pixel_data.conType = TWON_ONEVALUE

bright_data.oneValue.val = 0 ' Range is usually -1000 to 1000
bright_data.conType = TWON_ONEVALUE

Contrast.oneValue.val = 0 'Range is usually -1000 to 1000
Contrast.conType = TWON_ONEVALUE


rcode = TWsetmeasureunit(hwnd, unit_data) ' To set the device units
rcode = TWsetxresolution(hwnd, reso_data) ' To set the device resolution
rcode = TWsetyresolution(hwnd, reso_data) ' To set the device resolution
rcode = TWsetbrightness(hwnd, bright_data) ' Set brightness
rcode = TWsetcontrast(hwnd, Contrast) ' Set contrast
rcode = TWsetpixeltype(hwnd, pixel_data) ' To set the pixel type

srect.left = 0 ' Scan bed coordinates in 1000th inch
srect.top = 0
srect.right = 8500 ' 8.5 inches wide
srect.bottom = 11000 ' 11 inches high
'
If chkshowint.value = 1 Then
showUI = 1
Else
showUI = 0
End If
'choose here if multiple documents

If sourceName = "this" Then
Result = MsgBox("Scan multiple documents?", vbYesNo, "Scanning...")
Else
Result = 7
End

Scanning For Files
This is something I havn't done in VB before, and actually isn't covered (that I notice) in the 4 vb6 books I have.

This could be for a search, or almost anything, but I just want to give a 'root directory' and run through all the subfolders and record the path and filename of each file.

I know about app.path, but not how to get each file name, or how to rummage through each directory.

If anyone knows and can help, that would be sweet. My only thought on it right now, is that it has to be recursive, a sub calling another sub for every subdirectory to scan through all the directories, right?

heck, I can think of many uses for this sort of thing, from searching for a file to mapping out directories...

Thank you

Scanning Registry
I am trying to use this snip of code I found here on the forums. But I think I am missing some of the code. I keep getting unable to open key.


Code:
Dim ReadRegistry As String
Dim WshShell As Object
Set WshShell = CreateObject("WScript.Shell")
ReadRegistry = WshShell.RegRead("HKEY_LOCAL_MACHINESYSTEMControlSet001ControlClass")

msgbox ReadRegistry
What I am trying to do is scan the Registry for different values. Any help would be great. (I have been searching these forums for Registry, but not Finding what I need)

Web Server Scanning
hi, i have made my own webserver and ive just got it to send out large files like audo/video by streaming them. ive noticed that in winamp if you try to change the position. EG, move the slidy bit to another part of the file, it iwll request the file again but there is another line in the header information

range: bytes=26262-

now, ive got my server to cope with this but if the file is too big then will there be megabytes or something? will it always stay as bytes? if not then how do i make my server cope with that?

Scanning Bar Codes
A small question.
How can I get this to work?
I want to connect a bar code scanner to my Com Port and be able to receive data from it into a text box. Any ideas?
Olivier

IP Scanning For Scheduled WOL App
hi everyone,
Im new to the forum, as well as to "intermediate-advanced" vb programming, so Id appreciate any help you guys could offer.

Ok, so Ive been looking everywhere for a freeware Wake On LAN/network admin tool for the SOHO LAN Im in charge of, but I havent found anything free&good, so I want to build it myself. Basically, I want something that will send scheduled WOL wake-up packets to the office computers early in the morning to auto-boot them all up before the employees get there. Ive already found a free control that will create/send the packets given a MAC address, and Ive also found some code snippets that show how to translate a given IP into a MAC. So, all I need is to work on is figuring out how to "schedule" the packets and leave the program running in the server system tray(id appreciate any hints/advice on doing this...) and doing the IP scan for active hosts.

I want to add an option to the program that will automate the MAC address discovery&storage function, by clicking a button, and automatically scanning a small IP range (last block; ex.192.168.1.2 --->192.168.1.254) for active hosts, resolving each mac address, saving the MAC's, and adding them to the "WOL list" for the next morning. This way, I can auto-generate the WOL list during regular biz hours, and not have to set up each MAC manually. Theres probably only about 50 or less machines on the net. I dont even know where to start with the IP scan. Id appreciate any help anyone would be willing to offer.

Port Scanning
hello everyone,

i need help with port scanning. I'm tired of using anti-viruses that don't work properly. I mean this is the zillionth time my system has been affected . Anywayz, this brings me to my question, does anyone know of a way i can manually scan all the ports and see where data is coming from and where its going? A tutorial or URL would be even better.

thanxxxx
byeee.

Scanning An Image
I've got a problem with the scanning an image and save it to a default place.

my source code:
---------------------------------------------------------
If ImgScan1.ScannerAvailable Then
ImgScan1.ShowScanPreferences
ImgScan1.StartScan
ImgScan1.ScanTo = FileOnly
ImgScan1.Image = "C:image.tif"
Else
MsgBox "Scanner not available", vbOKOnly + vbInformation, "not available"
End If
Unload Form1
---------------------------------------------------------

The scan-dialog opens but if I take a snapshot it doesn't save the image to the harddisk. No error occurs!

some solutions?

regards da_brain

Scanning Directories
Hello!

How can I scan for all folders/subfolders of a certain directory?
I've read the tutorial talking about using recursive functions, but I didn't understand it very well. I terrible with recursive functions
Lets say that i have this dirs:

C:Base
C:BaseDir1
C:BaseDir1Subdir1
C:BaseDir1Subdir2
C:BaseDir2
C:BaseDir3

The user set a base path and then the program should add itens into a list with all the folders/subfolders into the base path.
In the example, if the user sets the base path as the "C:Base", the program should add this itens on the list ( just need the folders ):

C:BaseDir1
C:BaseDir1Subdir1
C:BaseDir1Subdir2
C:BaseDir2
C:BaseDir3

Could someone tell me how to do it? ( using or not recursive functions )

Thanks!

Scanning Pages
I am able to scan documents in vb, but I have a Document typed in MS Word, and i want to scan it and be able to enter text in the blank fields. I'm not wanting to change any of the words on the sheet, but if there is a blank line i want to be able to type in text. Can this be done?

VB Image Scanning
Hi, I'm trying to create, or find, a VB app that will allow for scanning of images through a scanner and send these images to a database (MS SQL). Well, it will store the images on a server, but the link to the images will be stored in the database. Any ideas?

Directory Scanning
How can i get VB to scan the current directory (app.path) and show only files it finds with the .ptn extension in a combo box or list box?

Thanks,
James

Scanning Windows
Hi all,

I need some brain storming before attempting to write an application for a friend of mine. I previously wrote one almost 1.5 year ago, but it seems that the working logic of that application is discovered so now it is not functioning as it used to.

Here is the story:

There are some online game servers ( free or licensed ones ) running on a host. People connect and have fun ( I guess ) on these free services. However some bad guys and ladies use third party cheating applications to disturb people who just wants to spend some time having fun.

The older application used to:

i) Scan all active top windows and check captions.
ii) Scan all child windows and check button, label, etc captions
iii) Scan for specific files and use simple Checksum algoritms to ensure
there is no editing or other stuff.

Now it seems that these methods are failing since some users are editing
third party tools, changing captions, buttons etc...

I thought that again scanning all active processes and then checking corresponding CRC32 figures may be a better apporoach, I didnt try it yet but I guess it will be extremly slow?

And I really appreciate your opinions, ideas about the issue..

Thanks all.

Scanning And Access
I need to write a subroutine using VB which will scan a given folder (including subfolders) and then add any file or files to a *.mdb database.

Is there anyone out there that can help me?

Thanks in advance

Copyright © 2005-08 www.BigResource.com, All rights reserved