vba

How to get the numbers matching with the name in vba code

Sorry about that. Basecly I want all the numbers in Col A That match with the names in Col B. I want to fill Col C with those numbers by order. Thank you ...

Is it safe to ignore ~sq_ queries when using LoadfromText

I'm working on some VBA to do exporting and importing (using SaveAsText and LoadFromText) of MS-Access objects in an application I'm supporting. I'm hoping to be able to start storing my code in SVN so that more than one developer can work on this application at once. I keep getting the following error when I bring in queries that start...

clearing an entire column in access

is there a way to clear an entire column in a datasheet in access? i can just right click on it and delete it but that will affect the structure, i just need to clear all the records. how do i do this? perhaps the question i should be asking is how do i clear the entire contents of a datasheet in access? ...

treating paramater as literal

DoCmd.TransferText acImportDelim, Import-Accounts, "tableImport", _ "C:\Documents and Settings\accounts.txt", True The second parameter: Import-Accounts is the actual name of the saved import specifications. supposedly it does NOT need to be in quotes; however in this case since there is a - there it is treating it as if i were doi...

Referencing An Object From ThisWorkbook

I need to populate several comboboxes in an Excel sheet upon loading it. I have the Workbook_Open() event set up on my ThisWorkbook code sheet in my VBA Editor. Now that the code isn't in my Sheet1 code sheet in my VBA Editor, the following code doesn't work: ComboBox.AddItem "hulkSMAASH!" How can I reference this combobox from my T...

what's wrong with this sql statement?

in access i am doing this: insert into accounts_changes (select * from accounts where [Agency Code] in (select * from tableimport)) it says that it doesnt like this INSERT statement update: sSql = "insert into accounts_changes (select * from Accounts where [Agency Code] in (select [Agency Code] from tableimport))" i did...

General ODBC Error in VBA

Hi am populating the data from MS Access By Using VBA i am using below mentioned code.if i am run the same code in MS 2007 then It run properly but if i am run the same code in MS 2003 it gives the "General ODBC Error" how to solve this problem Any help would be appreciated!! Thanks in advance Sub Button2_Click() Dim varConnection As S...

Programmatically Determine If An Excel File (.xls) Contains Macros

Is there any way to programmatically determine if an .xls contains macros, without actually opening it in Excel? Also are there any methods to examine which certificate (including timestamp cert) these macros are signed with? Again without using Excel. I'm wondering in particular if there are any strings that always show up in the raw ...

If/Then with RadioButton

In my VBA code, I query a SQL table. I want to add an if/then statement so if one radio button is selected it pulls a certain value, and if the other radio button is selected, it pulls a different value. My if is radiobutton1, and my else is radiobutton2, although the else can just be to take the other value. Here's the specific part of...

Timer functions and generating events with a callback

I need a better way of raising events than the SetTimer API in user32.dll. Have you used the other timer APIs successfully? Do you know another way of raising events or calling a function asynchronously in Excel? What do I mean by 'better'? I need something that can pop messages off of an internally-maintained queue, asynchronously. Th...

why was my report sent to the printer?

i have a button and in the click event i have this code: DoCmd.OpenReport "All_Ones" when i click it, for some reason the report starts to print! why is this? ...

access: displaying data on a report

i have a report that is attached to a query i want to display the contents of a query. there are three columns. i made a list box but it looks weird: i dont want the scroll bars, i just need the three fields from a query to be displayed regularly just as they would be in a spread sheet or grid ...

access: centering controls on report

thanks to hansup i have a bunch of fields on a report, i would like to center the enter block of controls. how do i do it? ...

Macro to Display String on Checkbox Select

I have a checkbox on sheet1 (there are about 7 sheets total). If the checkbox is selected (true), I want it to say "Approved" in cell M9. If the checkbox is not selected (false), I want it to say "Denied" in the textbox. Do I need to create a macro for that? If I want it to display the same text in cell M5 of sheet2, how would I put it...

Consolidating Columns in Excel

I have two columns in excel like the following a,apple a,bannana a,orange a,plum b,apple b,berry b,orange b,grapefruit c,melon c,berry c,kiwi I need to consolidate them like this on a different sheet a,apple,bannana,orange,plum b,apple,berry,orange,grapefruit c,melon,berry,kiwi Any help would be appreciated This code works...

How to add events to Controls created at runtime in Excel with VBA

I would like to add a Control and an associated event at runtime in Excel using VBA but I don't know how to add the events. I tried the code below and the Button is correctly created in my userform but the associated click event that should display the hello message is not working. Any advice/correction would be welcome. Dim Butn...

Question about using Subtotal and CountIf in Excel Macro (VBA)

Hi, I wrote a previous post (http://superuser.com/questions/151092/neophyte-question-about-using-subtotal-and-countif-in-excel), which I realized was not very clear. But I could not figure out how to edit it. My apologies for both blunders. Here then, is a much simpler version (I hope). I need to write a Macro to take the following typ...

Word 2007 macros: is there an OnPrint event I can attach a macro to?

I'm looking to do a formatting check on word files before they get sent to the printer and it needs to be completely transparent to the user (no extra controls, just using the standard print options available through the UI). Is there an OnPrint or BeforePrint event, or something that can be used in that respect which I could attach a m...

vba: getting list of all files with ESY extension in a directory

in vba how do i get a list of all the files with a specific extension in a specific directory? i am unable to do application.filesearch, because i am using excel 2007 ...

vba: get unique values from array

is there built in functionality in vba to get unique values from a one-dimensional array? what about just getting rid of duplicates? if not, then how would i get the unique values from an array? ...