vba

Excel Range describes a group of adjacent cells. When several groups of non-contiguous cells are selected, how do you get them all from Worksheet.Selected (range)?

My app needs to build a buffer from all the selected cells on a worksheet. I have it working correctly when the selected cells are all one contiguous group, but if the user selects a group of cells, then holds down the control key and selects other cells that are not contiguous to the first set of cells, the Worksheet's Selected range o...

Access VBA:To generate a report of result of update query

hi, Is it possibel to get a report of the records that are updated using a update query.I mean without using recordset. suppose sqltext = update table employees set bonus = 0 where salary > 50000 DoCmd.RunSQL sqltext now after theis query runs is it possible to get the name of th eemployees for whom this update query wa...

Any recommended training resources for VBA programming (e.g. DVD, computer) for non-software people?

I have been asked to find training resources to bring engineers up to speed on VBA programming. The target trainee will have some systems engineering experience but little to no non-systems programming experience. I'm hoping for a computer-based training course or DVD that we can purchase and give to the engineers for a couple days to...

Microsoft Word protecting styles using VBA and the "Protect Document" feature.

I am trying to limit the styles a user can use in a Word 2003 document. I am doing this by using the "Protect Document" feature. For my situation I may need to use VBA but I am not sure. After I protect the document, I can no longer apply a style to just a single word without it changing the style for the whole paragraph. For example ...

Access vba : to display time left when code is running

Hi, I have a form with a few buttons which execute code when pressed like running validations on the database. some of these code could could run for a few minutes so is there any way to show the time remaining or a message to display the % of process completed. or pop out a message when code evaluation starts and the message should di...

Excel automatically merge cells

I have an Excel table with several items 1, 2, 3..., each of which has subitems 1.1, 1.2, etc. I'm using the list of subitems as my key column and populating the main items using vlookups, but only showing each main item once. /| A | B | C | -+---------+----------+----------+ 1| Item1 | 1.Note | Item1.1 | 2| ...

Building undo into an Excel VBA macro

Excel macros don't seem to allow the use of "undo" after running them. Is there any way to bake undo functionality into a VBA macro in Excel? ...

import text file containing line breaks into excel

I have a plain text file looking like this: "some text containing line breaks" I'm trying to talk excel 2004 (Mac, v.11.5) into opening this file correctly. I'd expect to see only one cell (A1) containing all of the above (without the quotes)... But alas, I can't make it happen, because Excel seems to insist on using the CR's as row d...

VBA: Is it possible to run a form as a .exe file

Is it possible to save a form in VBA as .exe file and then run it. ...

How to call a javascript file (.js) via Excel VBA?

How to call a javascript file (.js) via Excel VBA? ...

outlook display icon in notification area for messages not in inbox

I have rules set to move some email messages into different folders. I would like this to still show the envelope in the notification area but there is no option in the rules wizard to do this. It looks like I would either have to have the rule "run a script" or "perform a custom action" allowing either vba or c/c++ respectively. Anyone...

Excel VBA or VSTO - How do you loop over Fields on a PivotTable?

Here is some sample VBA code: Sub Macro1() Dim pt As PivotTable Set pt = ActiveSheet.PivotTables("SomePivotTable") 'Set colOfFields = pt.PivotFields End Sub The third line is incomplete/broken. What is the correct way to get access to collection of all the fields in a PivotTable? I need to be able to loop over them. Act...

Write a formula in an Excel Cell using VBA

Hello, I'm trying to use VBA to write a formula into a cell in Excel. My problem is that when I use a semicolon (;) in my formula I get an error 1004. My macro is the following : Sub Jours_ouvres() Dim Feuille_Document As String Feuille_Document = "DOCUMENT" Application.Worksheets(Feuille_Document).Range("F2").Formula ...

How can I get a value from the update query prompt in Access VBA?

When we run a update query we get prompt saying that 'these many recordr are going to be updated. do you want to continue' is it possible to capture the value in the prompt message to a variable i.e the number of records going to be updated. ...

How do I write a DLL for Excel in Delphi?

I'm using Turbo Delphi 2006. The DLL will be called from within Excel as part of a VBA/DLL combination. The first part of the problem is trying to find out how to pass to the DLL a reference to the current Excel session. Most other code I've seen has you launching a separate instance of Excel apart from the one you're in. I've seen s...

last month in VBA Excel

I have a table with a large amount of information, how do i select just the last months worth? (ie just the last 31 cells in the column?) The data is in the form date1 numbers date2 numbers . . . . . . daten numbers where date1 is dd/mm/ccyy cheers ...

Easily using Excel data in SQL Server

I am regularly required to compare data sent to me in Excel spreadsheets with data that lives in SQL Server. I know that you can connect SQL Server to spreadsheets but it always seemed clunky This is really a post to show off my solution but I would love to hear other peoples ideas. ...

Question about CreateObject() in VB6 / VBA

I can do this: Dim fso As New FileSystemObject or I can do this: Dim fso As Object Set fso = CreateObject("Scripting.FileSystemObject") How do I know what string to use for CreateObject? For example, how would I know to use the "Scripting." part of "Scripting.FileSystemObject"? Where do you go to look that up? ...

Excel VBA Boolean expression order of operations

I have a test in Excel VBA: If (test1) And (test2) And (test3) Then 'do something End If In C, Java, etc. test1 would be run first, then test2, then test3. Critically, if test1 is false the whole test is false so the remaining tests aren't run. Does that happen in this case? If so, which order are the tests running? ...

Set Cookie from VBA

How can I set and get a cookie from within VBA code? Of course this is assuming I am not running server side scripting of any kind. ...