vba

Visual Basic 6 data structures

What are all the build in data structures for VB6 (Microsoft Access) ? I know there are arrays, but are there other more modern data structures? ...

I need code to copy between two rows and paste into the another sheet with our giving any values?

For eg: I have 50 rows of data. In that 1st row is having names of the students. I need the code to copy the data from RAM to RAMESH. In between I have 20 rows. I need the code to copy the rows and paste the same into another sheet. And It should not ask me for the names. By default, it has to take the names as RAM & RAMESH. ...

Can I do this in .Net and WPF?

Hi, We have a third party app that has VBA integrated into it. This all allow us to open a vb6 activeX Dll that contains a UI and we pass the apps instance to the vb6 dll. ' Instantiate the SMTree UI. Set oSMTree = CreateObject("SMTree.clsMain") ' Start it up. oSMTree.cMain Application Then in the VB6 app the main looks like: Publi...

Free VB6/VBA profiler and best Excel practices

We have a lot of reports that are generated via VBA & Excel. Only a small percentage of the reports are actual calculations - the majority of the work is sql calls and formatting/writing of cells. The longest of which takes several hours, the majority takes around 20-30 mins each. The VBA/Excel code plugs into a dll that the VB6 deskt...

Have Excel 2003 do a Find in a Word document and return the number of occurences

I have an Excel document that has a single column of strings (around 400 rows). I also have a Word document that may or may not have those strings in the Excel document. How can I have Excel do a Find in that Word document for each row in that single column and retrieve the number of times the given string appears? I only have Office 2...

Write Conflicts - even with me.dirty

In an application that I am writing, I am getting Write Conflicts when I use VBA code to change the value of a checkbox on a form. I have tried inserting the following code into the events that have VBA changing the values of any object on the form: If Me.Dirty Then Me.Dirty = False End If But the problem persists - as if the rec...

How to handle modal UserForms?

I have a UserForm with ShowModal set True. I want to use the dialog as a form and as a progress bar, so after the user clicks "OK", the form should remain on-screen but code should continue to execute in the background. What's the best way to go about doing this? Currently, I have two forms, one where the user enters data, and then ...

How do you test that a Range in Excel has cells in it?

I've found a problem in Excel/VBA in the Worksheet_Change Event. I need to assign Target.Dependents to a Range, but if it has no dependents it brings up an error. I tried testing Target.Dependents.Cells.Count but that didn't work. Any Ideas? Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count > 1 OR Target.Depe...

Listing subset of MS Access Tables in MS Excel with VBA

I have a series of stores Queries/tables in an MS Access 2002 database that starts with "RP_". I would like to list those table names in a listbox menu in an MS Excel 2002 spreadsheet. Any ideas on how to do this? ...

Excel: Finding and removing some characters in a column of data

I have copied and pasted some debugging information into an Excel sheet. However, it contains some "weird" characters in some cells of one column, that should otherwise contain integers only. What would be the easiest way to eliminate such characters using VBA? An example is shown in the list below: 1 **'␁'** <- I'm trying to get rid ...

Spellcheck with VBA in Outlook 2007 in a specified language

Hello I'm trying to spell check and send an outlook e-mail using the following macro: Sub SpellIt() Dim oMail As Outlook.MailItem Dim oDoc As Word.Document Set oMail = Application.ActiveInspector.CurrentItem Set oDoc = Application.ActiveInspector.WordEditor oMail.Save oDoc.Content.LanguageID = wdGerman oDoc.CheckSpelling oMail....

VBA introductory book for non programmer recommendation

A coleague of mine has shown interest in learning a little about vba scripting. Unfortunatelly, I don't have time to show her, and even if I did, I'm horrible at explaining things to people. Can you recommend a good VBA book for someone who's never done any programming, that is, has a nice easy approach with lots of examples ? I've chec...

IFDEF equivalent in VBA

I have code that needs to run on both Excel 2003 and Excel 2007, and there are a few spots where changes in the versions cause the code to halt. I tried separating these lines out with If-Else statements, but the code won't compile on either because it doesn't recognize the code used for the other. Is there any way I could tell one ver...

Retain cell address when sorting list

Here is a reduced version of what I need. Essentially, we have a list of components and their status (imagine they have been tested). Component BBB has two sub-components, BBB1 and BBB2. I want their status to reflect that of the BBB component 'parent'. Easily done, apart from the list is very long, and I need to retain the option to sor...

Create a SQL Table from Excel VBA

The problem is that I cannot get the table name that was entered into the variable, "tblName", to be used instead I get a correctly named database with a table named "tblName". Is there some way to pick up the name in "tblName" or some way to change the name once it is created with a name th user enters? Private Sub CreateDatabaseFrom...

Log Parser Early Binding

Is it possible to use early binding with LogParser.dll on VB6/VBA? When I try to set a reference to it, it just disappears with no error. ...

Environ for vba

I am looking for so good information or code examples of the environ function for vba to grab the username on the current system. ...

vba - Read lines from text file - Exclude top two lines?

Hi, I've got this macro code in Microsoft Office Word 2003 which reads the lines of a text file. The lines each represent a string value that I need to use later in the code. However, the first two lines of the text file contains some stuff that I don't need. How can I modify the code so that it skips the two first lines? The "intellis...

How to get a DateDiff-Value in milliseconds in VBA (Excel) ?

I need to calculate the difference between two timestamps in milliseconds. Unfortunatley, the DateDiff-function of VBA does not offer this precision. Are there any workarounds? Thanks in advance! ...

How to get the process ID of the current Excel, throught VBA, without relying on finding the window by the caption?

How can I get the process ID of the current Excel instance, that my VBA code is running in, without asking for it by the name in the caption... which causes a problem when I have two or more Excel instances with the same caption? ...