vba

How to find smallest values in AutoFiltered range?

I have a column with two value ranges, specifically 0-30000 and 60000+ from which I need to extract the smallest two values in the 60000 range. The only way I have found so far to to use AutoFilter to produce the subset of the required data to extract. My problem is that the Autofilter function does not return a reference to a range. If...

Outlook macro to search mails for text strings

I'm looking to search my emails for particular bits of text (or sender name) to be able to do things to those mails afterwards (i.e. delete, move to folder, remove content, etc.) Being an Outlook macro newbie, where should I start? Any ideas/pointers on the above or useful reference web sites much appreciated. ...

How to use the "post" parameter with the Excel's 2003 hyperlink "follow(...)" method?

If you look at Excel's help for the Follow Method of the hyperlink object, you'll see that it accepts POST as a way to send the data. How should I fill the "Extra Info" String or byte array? How should I format the data? What is the limit for the data to be sent? Please see below: expression.Follow(NewWindow, AddHistory, ExtraInfo, Meth...

MS-Access - how to trigger data insert before LostFocus event?

I have an procedure that runs on a control's AfterUpdate event: Private Sub cmdDelCountry_AfterUpdate() Dim strID As String strID = Me.ID Dim strCase As String strCase = 1 Dim cmdCommand As New ADODB.Command With cmdCommand .ActiveConnection = CurrentProject.Connection .CommandType = adCmdStoredProc .CommandText = "uspSal...

Word 2007 vba - Styles arent applied via macro

Hi, this is so weird. I have a macro code that basically creates a few tables, then types in some text in some of then, and then places a few text placeholders. The problem appear when I try to apply styles to the text. At first I thought it was only the placeholders that aren't affected by the code. But it seems as though regular text, ...

Access Application Changes not Working

I have an access application that displays data from our database and does some operations on that data. My problem is that I did not create this app, and when I try to add command buttons to a form, those buttons are not visible when deployed. Any idea what might cause this? To summarize: I add a button with VBA behind it, it works...

Iterating through columns in VBA (Excel)

When I typed that title, I came across many help topics and looked up few of them and got some basic idea. I still am stuck and that is why creating a new post to get some guidance. Scenario is this: My excel sheet has Y or N letter in A1, some text in B1 and a valid future date in C1. I currently have a VBA script that does this for ...

problem with vba macros code not equal to checking in decimal values

Hi friends, In Macros coding, i am checking the not equal to condition. Values are in decimal or integer, Now i compare the two values in decimal values but not get the proper result. Please guide me what is the thing should be added for getting corrected result? My code is : If fld4 <> fldval Then MsgBox "....." End If But ...

Convert a 300 character string to a uniquely identifiable 8 character string in VBA

I have designed an user interface for a tool where the user needs to enter a "Name" which is maximum 300 characters long, and the tool generates a text file ("Name".txt) which is then uploaded to a "server" (Mainframe and Unix). I want to shorten the 300 character string into a uniquely identifiable 8 character string (because of issues ...

Access bound textfield's AfterUpdate and Change events not firing

I have a simple form in Access. There are number of textfields. There is also one textfield on the form with the "Control Source" set to be sum of all the other fields on the form. So basically as a user modifies data on other fields, this "total sum" field gets updated automatically. This works fine. What I would like to do now is, ...

How can I automatically highlight and extract colored text in MS Word?

I have a bunch of documents that need to be edited. The authors use blue text in some parts of the documents to indicate that those words need to be linked. Thank you cornelius for the highlight text code: Sub HighlightNotBlack() Dim char As Range For Each char In ActiveDocument.Characters If char.Font.Color <> wdColorAutomatic An...

is there equivalent code in VBA Access 2007?

This appears to be .NET framework code. ByteImage = System.IO.File.ReadAllBytes("C:\my folder\my file") Since I am not using .NET, is there equivalent code in VBA (Access 2007) that will do the same thing? ...

VBA question: debug.print displays the correct data - how to get it out of Immediate window?

In my database I have certain tables that have confidential information. Each of these tables contains an empty field called "ThisTableIsConfidential". I have a function that correctly displays a list of the tables that have this field in the Immediate window. Now I want to display the list on a form and I can't figure out how to do it. ...

VBA: Difference between & and +

What is the difference between: string1 + string2 and string1 & string2 Are they equivalent? Why have two different symbols that do the same thing? ...

Using NT login as part of SQL query run via VBA in Access 2007

In Access 2007, I'm trying to use the NTlogin to retrieve a value from a table via a SQL query (see code below). WHen the form loads, I get an error message saying "Compile Error: Expected Function or Variable". Can someone tell me how to fix this error. Private Sub Form_Load() Dim UserName As String Dim strSQL As String D...

is there a way to check who has opened the macro?

i have an XLAM macro that runs as an add in. can i write a script in any language to identify the user (IP address or name of computer) who is currently using the macro?? ...

Possiblity to have custom user interface controls in VBA macro

I want to have custom user interface controls like accordian in my VBA macro in power point. By the way I'm using MS office 2003 version and is there any possible way to do this without implementing these things from scratch? ...

VBA Collections driving me nuts!

Hi guys, I'm still learning VBA and I can't figure out wth I'm having so many problems with a Collections object. I have a function that adds custom objects (I created a very simple class to store some data) that does the typical "read data, create object representation, stick it into Collections" sort of stuff. If I try to add a "key...

Mail Merge from Access - Save Merged Document

I am attempting to open a document from access, execute a mail merge, and then save the document output from the merge using VBA. Here is my current attempt: Dim templateName as String, tempRoot as String tempRoot = "C:\report\" templateName = tempRoot & "template.doc" Dim objDoc As Word.Document Dim objWord As New Word.Application Se...

ms-access record/page level locking

i am baffled as to what is happening with the database i have a split front and back end access database every user has their own front end sometimes some users are able to edit the data and sometimes not. i don't know how to explain this here are the settings: anybody know what is going on here>? ...