vba

How do I access the selected rows in Access?

Hi community, I have a form which includes a data sheet. I would like to make it possible for a user to select multiple rows, click on a button and have some sql query run and perform some work on those rows. Looking through my VBA code, I see how I can access the last selected record using the CurrentRecord property. Yet I don't see h...

Open,Read,Write Files on Network Attached Storage via VBScript

I have thousands of small CSV files I want to aggregate (with a little munging in-script first). They are on a NAS device, a "SNAP" Server to be more exact. I've had some success with VBA from Excel - doing about 700 files in about a minute, if I recall (was a month ago). Actually, it was half-success: the snap server is home to 80% pdfs...

Excel VBA custom function with sumif-like criteria functionality

In Excel, I'm writing a custom function in VBA that needs to take a criteria string and criteria range like the built-in SUMIF function. Does Excel expose the functionality to test a criteria string anywhere in its API or do I have to write it myself? In case it's relevant, I'm writing a "CountUniquesIf" formula, that counts the unique ...

MS Excel 2003 - Simple unselect question in Excel VBA when dealing with shapes

So I have an excel workbook that has a global mapping scheme in it. So I have a shape for each and every country in excel. Depending on the region select, relative to the data/query, it will shade regions/countries in various ways. So I know how to manipulate each shape in terms of colors, gradient shading, etc.... What I don't know ho...

[VBA ?] Rich text format (with formatting tags) in Excel to unformatted text

Hello, I have approx. 12000 cells in excel containing RTF (including formatting tags). I need to parse them to get to the unformatted text. This is the example of one of the cells with text: {\rtf1\ansi\deflang1060\ftnbj\uc1 {\fonttbl{\f0 \froman \fcharset0 Times New Roman;}{\f1 \fswiss \fcharset238 Arial;}} {\colortbl ;\red255\green2...

Execute .NET 3.0 code from Office 2003

I've created a DLL in C# using the .NET 3.0 framework. Below is the code of my DLL namespace CompanyName.Net { [Guid("F7075E8D-A6BD-4590-A3B5-7728C94E372F")] [ClassInterface(ClassInterfaceType.AutoDual)] [ProgId("CompanyName.Net.Webrequest")] public class WebRequest { public string Result { get; private set;...

Determining the size of a merged area

Right, before we get off about merged cells, I hate them too, but I've to deal with them anyway. I cannot change anything about that now or in the future. As much as I would like to ;) Say I have some merged cells, I need to determine the amount of cells it spans. Say A1:A4 are merged, then I need to have the number of merged cells, 4, ...

How to reformat Outlook mail item in VBA

Okay, i've got an Outlook 2003 VBA macro that clears a mail item's categories, and this is assigned to a button. However, i've got a conditional formatting rule that's already been applied, so when (in the inbox list view) i run the macro, the categories are cleared but the conditional formatting on that item remains until i select a dif...

Network analysis and adjacency matrices

I want to try and create a network for several hundred shapefiles that consist of polylines. The polylines are snapped to each other and consistent. Then I want to create an adjacency matrix for this network. What is the best way of doing this? I know how to do it on an individual basis by clicking through options within ArcCatalog, but...

Count unique values in Excel

I need to count unique values in range (C2:C2080) in excel. Googled formula: =SUM(IF(FREQUENCY(MATCH(C2:C2080;C2:C2080;0);MATCH(C2:C280;C2:C2080;0))>0;1)) return incorrect value. UPD: Lame solution: Sub CountUnique() Dim i, count, j As Integer count = 1 For i = 1 To 470 flag = False If count > 1 Then For j = 1 To ...

Unable to set ComboBox.RowSource on continuous form

I am having trouble setting the row source of a certain combo box on my form (viewed as a continuous form, although I also seem to have some problems in single-form mode). The combo-box is bound to a field called supplierID, and is meant to present the user with a list of all the possible suppliers for an item. The row-source I am usin...

Error with Excel Automation/Office Interop for Microsoft.Office.Interop.Excel.WorkbookClass.ResetColors()

I've written an application that converts 1000s of Excel documents into PDFs (I know this is a slow method, but I'm not worried about speed), using the same technique as this, but for Excel instead of Word. I had the requirement to add the following code: book.ResetColors(); This is on the Workbook object. For the majority of cases t...

Microsoft VBA idiom (Visio) For Testing Non-Existance of a property?

I need to ensure a Macro which works on Visio 2003 doesn't cause problems on lower versions of Visio: specifically because I'm writing to a property which doesn't exist on lower versions of Visio. Currently I'm doing this: ... On Error GoTo NoComplexScriptFont: Set cellObject = shapeObject.Cells("Char.ComplexScriptFont") On Error GoTo E...

MS Excel 2003 VBA - Is there a way to define a group of shapes/object into a "group"

So I have this global mapping scheme, and each country on it are individual shapes. I learned how to manipulate colors/fill based on certain criteria. So the way I do this, or the way I know how is one shape/object at a time. For example USA is "C_USA", Canada is "C_CAN", etc. So is there a way I can define countries into groups?? ie. ...

How to Print a list of sheets in vba Excel

I make a index of a list of sheets in a workbook, i will like to print some of then (list in column A, a mark in column B the ones i would like to print) Do you have some code for it, in VBA Excel??? I Will really thanks ...

VBA/ADODB Run-Time Error: 3704

The following VBA subroutine will run most queries just fine. (ie: SELECT * FROM DUAL) Sub DisplayQuery(QueryString As String) Dim rs As New ADODB.Recordset Dim connStr As String connStr = _ "Provider=MSDAORA.1;" _ & "User ID=abc;Password=123;" _ & "Data Source=xxx/xxx;" out QueryString rs.Open QueryString, connStr, ...

VBA Word Macro doesnt recognize whitespaces or wildcards

Hi guys, I have a VBA Word Macro that gets words from .txt list and color highlight them in a word .doc document. The problem is that the script ignores whitespaces and wildcards from the .txt list. I insert the word "wit" but it also changes words like witHIN , witCHE, etc. I tried inserting wildcards in the .txt file, like or usi...

Excel VBA to SQL Server without SSIS

Excel problem: User clicks a button and VBA parses an input file, putting data into cells in the spreadsheet. Then she mails copies of the spreadsheet to people who do work with the data. I am to replace this with SSRS or ASP or Sharepoint displaying the data from SQL Server. In order to work on this without interrupting the current ...

How to rename an Access Table using VBA from Excel?

I´m trying to rename an Access Table using VBA from Excel... any help? ...

Help need Pls.... excel macro: compare and copy between worksheets

Heres mine problem If cell H of worksheet A = cell E of worksheet B (contain words) and If cell J of worksheet A = Cell H of worksheet B (contain numbers) and If cell K of worksheet A = cell I of worksheet B (contain numbers) then copy cell O of worksheet A to cell L of worksheet B (contain numbers) (put in ot...