vba

VBA - "Can't find Project or Library" for standard VBA functions

So I'm having to run someone else's excel app on my PC, and I'm getting "Can't find Project or Library" on standard functions such as date, format, hex, mid, etc. Some research indicates that if I prefix these functions with "VBA." as in "VBA.Date" then it'll work fine. Webpages suggest it has to do with my project references on my sys...

How do I use a Checkbox on a form to add a record into a subform in Microsoft Office Access?

I have a database for a carpet company. I have a form which enables the user to make a quote, including choosing the customer, etc. There is a also subform dealing with the products and extras, with quantities and unit prices. To state whether the user requires fitting there is a checkbox. When ticked I would like fitting to be added in ...

How do I retrieve Visio custom shape information with VBA

Using VBA, how do I retrieve custom shape information from a Visio 2003 diagram. ...

Assigning text to an array

This is driving me crazy. How can I assign a set of text values to an array? Nothing I try is working! Months = Array("Jan", "Feb",... etc does not work! ...

Using .Find to look in another worksheet

I have aset of account names in one workbook (the active one), and I need to use the .Find function to look for their ocurrences in another workbook/sheet. I don't think I'm getting the right Object handle for the other workbook/sheet, but nothing I try is working. For Count = 1 to 10 accName = Cells(Count, 1).Value AccRow(Count) = OB...

Using Range Values with Find

I am using .Find to look for a string, but the cells I want to search have formulae in them; what I want to compare in the result of those formulae. So far I have: cellrow = Range("A1:D4").Find("string").Row But it will return an error unless there is a genuine text 'string' in any of the cells. How can I modify this so that it is look...

Show Cell Range on UserForm; then update

I've been using a crude method to help the user update some cells - by having them in a sheet. Is there any way I can display the various ranges in a userform, one by one, then have the user update them, click a button and move onto the next one? Essentially, can I have Excel automatically generate an input form based on a range? The pr...

Error: "Could Not Find Installable ISAM"

I've written some VBA code in an Excel workbook to retrieve data from an Access database in the same directory on a desktop. It works fine on my machine and several other machines running Windows XP, but when we tested this on a Vista machine, we encountered the "Could not find installable ISAM" error. I've done a bunch of searching on...

Non-web SQL Injection

There seems to be some hysteria about SQL Injection attacks. Most recently, here http://stackoverflow.com/questions/505838/vba-simple-database-query-from-word If I'm creating a macro in Excel that connects to an Access database, do I really have to be concerned about SQL injection? It's not on the web, it's used in my office (you guy...

Non-Sequential Range

Can I set a Range Object to be equal to a set of non-sequential cells? I want my Range to be equal to cells A1, A3, A5 etc, where I can pick and choose the rows and columns at will. ...

vba: getting value of a cell across all tabs

Greetings, I'm trying to write a vbscript function that collects the value of a cell ("E1") across all tabs of an excel document into an array (Reviewers). I wrote the following code, but the data is not being stored into the array, can someone please tell me what I'm doing wrong? this is the code: http://img24.imageshack.us/my.p...

Is there a need to set Objects to Nothing inside VBA Functions

Hi, I always read that it is recommended to set objects to nothing, once I am done. But I normally use them only in functions inside forms. Isn't the reference lost when the function scope is left? So where is the need to do: Set db = Nothing Set record_set = Nothing Cheers, Ramon ...

VBA String sanitation

I get data imported from an Oracle database and use Excel to create some reports from that. Recently one of our data entry folks has started beginning her entries with "+". Excel than evaluates that and adds = then displays the dreaded ?name# error. The error is error 2029. I tried using If IsError(C.Value) Then C.Value = Repla...

How to Reverse the Order of a Selected Range of Excel Columns using VBA

I am new to VBA and am trying to figure out how to reverse the order of a selected range of columns without hard coding. Every example I look out either hard codes the columns to reverse the order of, or assumes you want to reverse all the columns in the worksheet. I'm not trying to ask someone to write this for me, but as simple as this...

Ms-Access Query is getting deleted automatically. What can be the reason?

Some of the queries I have written inside MS-Access are getting deleted automatically. And while I run the queries through code, I get this error 'Query should have one destination field' What can be the possible reason Explanation: I created a query in MS-access. Ran it from the code. Closed the database. Started it again, and now fo...

What does <> mean?

I have seen this before in SQL and VB, I am now reverse engineering an Excel speadsheet and have come across the following formula: =IF(D23<>0,"Insufficent",0) I am converting it to ActionScript: var result:String = [condition] ? 0 : "Insufficient"; but I am unsure of what D23 <> 0 means, is it simply "not equal"? ...

Dynamic generation of Forms in Excel using VBA

I'm trying to find or develop some VBA to dynamically generate form fields (labels and textboxes). The source data is a table on a hidden Excel worksheet. Any ideas? ...

Activate Range, Allow Edit, Continue

As a secondary method to my question here: http://stackoverflow.com/questions/511488/show-cell-range-on-userform-then-update I would like to have a macro that selects a range, and activates it, but allows the user to edit cells in that range. Then, it needs to have a button that moves onto the next range. Is there a way to keep a form v...

HowTo Copy data by a double click on a specific cell of one sheet to another sheet

Hallo I am writing down the requirements of what I want to do using a macro in excel: I have a workbook with 4 worksheets: The SourceSheet where I save my database, the TargetSheet where I want to send some products of the database, in order to do some calculations,the resultsSheet and the InfoSheet. If the user double clicks in a ce...

Differences between Visual Basic Editor and Microsoft Script Editor?

I'm starting to learn Excel Programming and have been doing the development in Excel Visual Basic Editor. I now have the option to get Visual Studio 6, so I would like to know what are advantages of using Microsoft Script Editor. What are your thoughts? ...