vba

what is the probability that the next random number will equal current one?

if i do this in a worksheet: =RAND() i also specified that i want only 2 decimal places and for example let's say that rand() = 0.07 what is the probability that when i call this function again i will get 0.07 ?? i know that ideally if we assume 100% randomness, the answer would be 1/ (10 * 10) because there are only 100 possible c...

Return Empty String as NULL

I have a listbox select and I want when the user selects null for the empty string it produces to pull the nulls from the SQL table. Here's what I have now. Blank strings return nothing because there are no empty fields in the table. SELECT * FROM dbo.Table WHERE ID = " & TextBox2.Text & " and And Field1 IN (" & Msg1 & ") How do I co...

my macro is stuck how do i kill it?

i have a macro that goes through a directory and looks at all the files unfortunately it's on a mapped network drive and its really slow how do i stop the macro? ...

Pass a range into a custom function from within a cell

Hi I'm using VBA in Excel and need to pass in the values from two ranges into a custom function from within a cell's formula. The function looks like this: Public Function multByElement(range1 As String, range2 As String) As Variant Dim arr1() As Variant, arr2() As Variant arr1 = Range(range1).value arr2 = Range(range2).va...

vba: clear entire array

i have an array like this: Dim aFirstArray() As Variant how do i clear the entire array>? what about a collection? ...

vba: a forever loop

Sub something(tecan) On Error Resume Next Dim arr As New Collection, a Dim aFirstArray() As Variant Dim i As Long aFirstArray() = Array(Dir(tecan & "*.ESY", vbNormal)) aFirstArray(0) = Mid(aFirstArray(0), 1, 4) Do While Dir <> "" ReDim Preserve aFirstArray(UBound(aFirstArray) + 1) aFirstArray(UBound(aFirstArray)) = Mid(Dir, 1...

Programatically rebuild .exd-files when loading VBA

Hi, After updating Microsoft Office 2007 to Office 2010 some custom VBA scripts embedded in our software failed to compile with the following error message: Object library invalid or contains references to object definitions that could not be found. As far as I know, this error is a result of a security update from Microsoft (...

Enter key with multiple forms on a website.

I have a website with 2 forms. One for search and another for the login. When I use the enter key to submit, the search is always called because it is the first form on the page. What I want to do is program the enter key to click a certain button when a certain textbox has focus. I'm using asp:textbox and asp:button for my login form....

Run-time error 459 when using WithEvents with a class that implements another

I am developing a VBA project in Word and have encountered a problem with handling events when using a class that implements another. I define an empty class, IMyInterface: Public Sub Xyz() End Sub Public Event SomeEvent() And a class, MyClass that implements the above: Implements IMyInterface Public Event SomeEvent() Public Sub ...

Python win32com - Automating Word - How to replace text in a text box?

I'm trying to automate word to replace text in a word document using Python. (I'm on word 2003 if that matters and Python 2.4) The first part of my replace method below works on everything except text in text boxes. The text just doesn't get selected. I notice when I go into Word manually and hit ctrl-A all of the text gets selected ...

sending SMS with VBA

does anyone know if this is possible? i was able to succesfully run hyperterminal and use it to send texts through my phone which is attached by USB. anyone know how to do it in VBA? ...

vba: This key is already associated with an element of this collection

Dim arr As New Collection, a Dim aFirstArray() As Variant ...some code For Each a In aFirstArray arr.Add a, a Next i get this error: This key is already associated with an element of this collection on this line : arr.Add a, a what am i doing wrong? ...

How to set checked property in vba (format or control toolbox)

I'm trying to change the value of my checkbox to true based on a another cell's value if range("A1").value = "green" then Checkbox1.value= true end if How to I change the value property to true for multiple checkbox at the same time For some reason the code that i've tried doesn't do anything at all. P.S. I'm using format checkbox...

vba: macro escapes for-loop !

sub main() '''some more code''' For j = InStr(1, stext, " ") To Len(stext) If IsNumeric(Mid(stext, j, 1)) Or IsAlpha(Mid(stext, j, 1)) Then letter1 = Mid(stext, j, Len(stext)) Exit For End If Next j '''some more code''' end sub i am walking through line by line. as soon as the macro g...

How can I upload data using ftp, http, or a socket from a spreadsheet with VBA for Microsoft Office?

I have an Excel spreadsheet, and I want to put a button on it, so users will be able to upload their data to an http/ftp server, or send the data to the server using a socket directly. I have noticed that some people creates an ftp script to do. First of all, I'm not sure that everybody has ftp on their Windows machine, and secondly, I w...

SMS connecting to a phone from C# and getting a response

I wrote code to send an SMS using my GSM phone which is attached to the computer through COM port. The code is below. The problem is I do see that it is in the outbox of the phone and it actually appears to have been sent, but when I contact the recipient they say that I have not received the message. I test the phone, and I create and...

sending AT COMMANDS

does anyone know where i can get the official list of all AT COMMANDS available? i would like to get my computer speaking to my cell phone. i need all AT COMMANDS and i will hook it up to either .NET or VBA or anything else. btw i have a motorola phone ...

To pull data into Microsoft Excel 2007 with web queries

Hi, How can i perform to enter username and password when want to pull data into Microsoft Excel with web queries??? Have any solution can be used to solve this kind of problem? ...

How to Lock the data in a cell in excel using vba

I want to stop others from editing the cell contents in my excel sheet using VBA. Is it possible to do this? ...

AES Encrypting a Microsoft Access Field Via VBA

I need to create a Microsoft Access database, but have a need, in one of my tables, for a single field to be strongly encrypted. Since AES requires both a key and an initialization vector, I've decided to solve this problem by requiring a password to access the database (as the key), and a field in the table to hold a SHA1 hash of the ...