vba

Is it possible compare two excel files, using vba?

I would like to know if using VBA I can compare two similar excel files and shows the differences highlighting the background of cells or rows with different colors. ...

How to remove a specific category on a selected mail in Outlook 2003 with Macro?

Hi, I am trying to transform my Outlook2003 into the closest thing to gmail. I started to use categories, which are pretty similar to labels in gmail. I can assign categories automatically with rules, and I can add categories manually. I have also created "search folders", that show all mails with a given category, if they are not in...

Excel Macro to find text in cell and insert hyperlink on cell

We're managing some system bugs in a web system and setting priority for execs in a spreadsheet. Each of the tickets has a "FD-" and four numbers as the ID. The web system has a hyperlink that has that "FD-####" at the end of the link. The end result would look like this -- http://www.mytickets.com/FD-#### I'd like to run a macro that f...

What's wrong with this regex (VBScript/Javascript flavor)

I'm trying to run a regular expression in VBA code that uses Microsoft VBScript Regular Expressions 5.5 (should be the same as JavaScript regex) regex: ^[0-9A-Z]?[0-9A-Z]{3}[A-Z]?([0-9A-Z]{6})-?([0-9])?$ input: X123A1234567 match: 123456 The six characters I'm interested in give a good match of 123456, ignoring the last (check) digit. ...

Executing LINQ Queries In Excel To SQL

I want to be able to interact with an SQL database using LINQ and Excel (it's a legacy thing). Is this sort of thing possible? I'm screwing around with SQLMetal, and have generated some database classes in VB, but they don't seem to go in smoothly into Excel (I'm getting a lot of red error text). Any ideas would be appreciated. ...

Access VBA question: Change the query being referenced by a function, depending on context

I have a custom function in Access2007 that hinges on grabbing data out of a specific query. It opens Outlook, creates a new email and populates the fields with specific addresses and data taken from the query ("DecisionEmail"). Now I want to make a different query ("RequestEmail") and have it populate the email with that data. So all I ...

loading Data in VBA from a text file

I am not very familiar with VBA but need to use it for a new software program I am using (not Microsoft related) I have a text file that has columns of data I would like to read into VBA. Specifically the text file has 4 entries per row. Thus I would like to load in the column vectors (N by 1). The text file is separated by a space be...

Repeating random variables in VBA

How can I use randomize and rnd to get a repeating list of random variables? By repeating list, I mean if you run a loop to get 10 random numbers, each random number in the list will be unique. In addition, if you were to run this sequence again, you would get the same 10 random numbers as before. ...

ms-access: filling out an application by printing over it

i will be printing the access report. the report will not be printed a regular white paper. it will be printed on top of a paper with checkboxes and fields on it. i need those checkboxes and fields to be printed on according to the access data. are there any libraries for access that make this easier? is there a feature that will help t...

Use same name for local variable and function

In VBA, I want to use a name for a local variable that I'd also like to use for a function name. The problem I'd that the function name formatting always changes to the local variable formatting. Any way to prevent that? ...

how run Access 2007 module in Vb6?

I have created a module in access 2007 that will update linked tables, but I wanted to run this module from vb6. I have tried this code from Microsoft, but it didnt work. Sub AccessTest1() Dim A As Object Set A = CreateObject("Access.Application") A.Visible = False A.OpenCurrentDatabase (App.Path & "/Data...

ms-access: designing a report: printing text on specific x,y coordinates

i need to design a report that will print text on specified x,y coordinates for example, i will input (50,50), (60,60), (70,70) and i will have my program print text at those specific coordinates on the report. in total there will be about 50 different coordinates. how do i achieve this? should i be using a label control or a textbox? ...

FilePageSetupHeader in MS Project VBA project: Display image dynamically

I want to display an image when printing a page from MS Page using the FilePageSetupHeader. It all works fine if I pass in the parameter for the Text property as a string as such FilePageSetupHeader Alignment:=pjRight, Text:="&P""C:\filepath\image.gif""" However, I'd prefer to be able to pass the filepath to the image to display as a ...

word macro to save a selected range into database.

Is there a way in word to save a selected portion into the database(Ms Access) as range object.So that we can later retrieve it . It is required to generate a report in word ,the section needs to be repeated many times. I have searched net for quite some time but not much material is found. thanks. eg:In a Resume automation application. ...

multi-thread in MS Access, async processing

I know that title sounds crazy but here is my situation. After a certain user event I need to update a couple tables that are "unrelated" to what the user is currently doing. Currently this takes a couple seconds to execute and causes the user a certain amount of frustration. Is there a way to perform my update in a second process or in...

Finding The DSN To My Database?

I have an SQL database and want to connect to it using VBA in order to support some legacy functionality. I'm using an ADODB connection and need to know what my database DSN is. How can I find this? I'm using SQL Server 2008, thanks! :D ...

Can you pass parameters for OnAction in MS Project VBA?

The way I can define a method to be executed with OnAction in VBA with Microsoft Project is as follows (and works correctly): .OnAction = "Macro ""DoSomething""" ... where DoSomething is the method to execute. I would like to pass a parameter to that method but can't find a way to pass it with this syntax. Does anybody have an idea h...

VBA ODBC Update

This is the code I'm using to update an SQL database: Public Sub main() Dim cnn As ADODB.Connection Dim rst As ADODB.Recordset Set cnn = New ADODB.Connection Set rst = New ADODB.Recordset cnn.Open "ConnectionName" rst.ActiveConnection = cnn rst.CursorLocation = adUseServer rst.Source = "Update Table ....

Dynamic Chart Series Labels

I have some Visual Basic Code that creates a chart for each row. It sets the series values using this code: .SeriesCollection(1).Values = "=" & Ws.Name & "!R" & CurrRow & "C3:R" & CurrRow & "C8" What I am struggling with is how do I set the series labels? The series labels will always be the 1st row and be in the corresponding column...

Now() In ODBC SQL Query?

I'm trying to update a database field to the current time, but can't pass "now()". I get the following error: 'now' is not a recognized built-in function name. The method I'm using to query the database is as follows: Public Sub main() Dim cnn As ADODB.Connection Dim rst As ADODB.Recordset Set cnn = New ADODB.Connectio...