vba

adding linefeed to memo field type

The linefeed does not appear in access db: Set db = OpenDatabase("C:\temp\a.mdb") db.OpenRecordset("table1", dbOpenTable) .AddNew ' create a new record .Fields("memofield") = "123" + chr(13)+"line2" .Update ' stores the new record ...

Converting Excel line breaks to vbCrLf?

My columns have line breaks, but how can I convert these to vbCrLf when reading with Range("A" & r).Value? ...

How to extract the table design to excel sheet ?

I want the column and data-type of a table in VBA ms access form how to do it easily? ...

Why is Excel VBA giving me an error for a dynamic Range?

I am trying to create a budget using a Match function, but I can't even get to that point because the dynamic Range I am trying to create is returning the error: "Application-defined or object-defined error". The range in question is rng Sub Material() Dim wSheet As Worksheet Dim x, dwIndex, offSet, count, upperLeft, bottomRight, r, w...

Excel: Set background colour of cell to rgb value of data in cell.

I have a column containing rgb values, eg 127,187,199 67,22,94 In Excel, is there any way I can use this to set the background colour of the cell? ...

Error handler naming

Is there a best practice for naming the error handling section? How about the resume label? I use "ErrorHandler:" and "ProcExit:". Thanks. ...

Get all source code in mdb file (msaccess) using C#/VBScript

I would like to get all the source code from an Access database (forms, modules) without using Office interops. I liked the AllCodeToDesktop() function found here. However that runs from inside the mdb file. What would a VBScript file be that loads the mdb file and runs that function on it? ...

Excel DateAdd not working properly ?

I am trying to use Excel the DateAdd function to find the next working day. It seems that Excel is not working as expected with this function, and always provides the same result wether you use d, w or y for the period argument. (by the way the explanations of the "y" value are beyond my logic). I tried the following code, and get ident...

Visual Basic for Visio: "Invalid selection identifier"

I am a total beginner here, so this is probably something simple I'm overlooking. The following Visio macro (using VBA) rotates the currently selected shape: ActiveWindow.Selection.Rotate90 My question: how can I store that shape into a variable? I tried the code below and don't know how to change it to make it work. Dim s1 as Shape...

What's wrong with output parameters?

Both in SQL and C#, I've never really liked output parameters. I never passed parameters ByRef in VB6, either. Something about counting on side effects to get something done just bothers me. I know they're a way around not being able to return multiple results from a function, but a rowset in SQL or a complex datatype in C# and VB work ...

Unable to access Excel Form Objects through VBA when Items are Grouped

Is there anyway to access (through VBA) properties of a form object (using the forms toolbar for pre-2007, and on the developer tab / insert / Form Controls for 2007) when it is grouped? For example, normally you could access the max property of a Spinner control with the following code: Sheet1.Spinners("Spinner 1").Max OR Sheet1.S...

regular expression in vba excel looking for groups out of a string

I am currently working on a vba project that has the end user copy/paste long strings of text into a worksheet and the code to parse out data from the junk in these strings and organize it from them. The strings will always be in different lengths, and have a different number of spaces between the data. However they will always be g...

Rookie SQL inside of VB question - MSAccess 2003

Hey guys, can anyone help me with a simple question. I have this SQL statement below in a sub in VB within access from a button click, and I am new to this. Here is what I typed: Private Sub Command0_Click() Dim rs As Recordset Dim sql As String Dim db As Database Set db = CurrentDb sql = "SELECT * FROM Transactions" Set...

Getting wildcards to work in find and replace function in VBA macro for Microsoft Word

Hello all! Thanks in advance for your help! I have a VBA macro for Microsoft Word that I am trying to improve. The purpose of the macro is to bold and italicize all words in a document that match the search terms in the first table of the document. The problem is the search terms include wildcards which are the following: the hy...

VBA Shell and Wait with Exit Code

I am wrapping up an office application (VBA) that makes a call to a C# console application to perform some of the heavy lifting for the application (large simulation program). I would like to be able to have the VBA application wait for the console application to complete as well as retreive the exit code from the console application. ...

HOW TO close Excel instance started by mail merge

HOW TO close Excel instance started by mail merge this code running inside launcher does not have access to Excel running via DDE ?? 'For i = 1 To Workbooks.Count ' MsgBox ("here" + Workbooks(i).Name) 'If (Workbooks(i).Name <> ActiveWorkbook.Name) Then 'Workbooks(i).Close 'End If 'Next i ...

MS Access 2003 VBA String Split on Line Break

I have a textbox on a MS Access form that users are going to copy a column of numbers into from an excel spreadsheet. I need to take this input and use it as parameters to build a query. I have code that looks like this Dim data as variant Dim input as String data = Split(input,vbLf) I want to be able to build a list of the input fr...

possible to intercept and rewrite email on outlook client side using ironpython?

I want to intercept and transform some automated emails into a more readable format. I believe this is possible using VBA, but I would prefer to manipulate the text with Python. Can I create an ironpython client-side script to pre-process certain emails? EDIT: I believe this can be done with outlook rules. In Outlook 2007, you can do...

How to design a simple database for charitable donations in MS-Access?

I have been asked to build a simple database for my church. Those using the database will need to use the form view only, so I am trying to make it very user friendly. The church has 3 bank account (checking, savings, and allocated). The allocated account is my problem. This account holds money for 4 separate missions, fundraisers, youth...

Excel VBA: Recreate Source Data from Pivot Table Cache

I am trying to extract the source data from a pivot table that uses a pivot table cache and place it into a blank spreadsheet. I tried the following but it returns an application-defined or object defined error. ThisWorkbook.Sheets.Add.Cells(1,1).CopyFromRecordset ThisWorkbook.PivotCaches(1).Recordset Documentation indicates that Pivo...