vba

Storing and recreating relations in Access

I'm wondering if it is possible to use VBA to store, delete and recreate relationships on tables in Access VBA? The deletion part is easy, but how to store it in such a way as to be able to restore it after it's been deleted is where I get stuck. I originally wanted to know so that I could bulk copy certain tables from one database into...

Excel listing named range in a worksheet and get the value

Hi there, How to obtain a list of named range exist in a specific worksheet that start with particular string (for example all named range that start with total) and grab the value? I am trying to do Sub Total and Grand Total of accommodation cost based on the date. I will assign an unique name for each Sub Total based on the Date group...

VBA outlook attachmets

In vba how do I attach the entire contents of a folder to outlook as an attchment? ...

Converting vba to c#

Hello, I am currently in the process of converting some excel VBA to C# and I am stuck on one thing. In VBA I have some public variables declared at the top of the module, outside of the Functions and I can access and modify these from any module or function. Example: Module A: public A As Double public B As Double Publi...

Delete a MS Word Page using macros

Hi All, How can I delete certain page from MS Word document using macros? The code should be compatible from 2000 to Word 2010. I've tried using page bookmark to delete page but, output is varying in different versions. Is there any other solution than this? ...

Best Mac OSX and Windows Git Clients, servers and diff tools?

Hello, I am currently looking for git clients for Mac OSX, I have tried the following: GitX (Didn't like it.. doesn't seem functional enough) Git Gui / GitK.. (Butt Ugly! i mean yuuuuuck! and not user friendly) Source Tree (By far the best but still lacking somewhat) Is there a functionally equivalent nice looking "versions" or "cor...

how to query a table?

Suppose we have one table in Microsoft Access: ID | Data I need to select one row with a SQL query in VBA code. In what variable to store that row? How to write that row back to the table in VBA? Could you please write simple code? ...

Manipulating Access VBIDE from VBScript

I'm trying to write a vbscript that will export and import the code modules from an Access MDB file to text files. From within the app I can loop through the DAO Container & Documents and use the 'undocumented' Application.SaveAsText method, but can I do it exeternally? Your thoughts and ideas are appreciated. Ben ...

How to export all tables from an Access Database into Excel - A sheet for each table...

I have an Access database with ~30 tables. How can I export all 30 tables into separate sheets in an Excel workbook? I'm hoping to find some VBA/VBS code which I can run from within Access to accomplish this task. Any ideas? ...

vba: return dictionary from function

this outlines what i am trying to do. this is not working for me, and it is unclear why. thank you in advance for any and all help. Sub mySub() dim myDict as Dictionary myDict=new Dictionary myDict=myFunc() End Sub Function myFunc() dim myDict2 ...

VBA While loop using an SQL statement as my While.

Hi there, I'm writing some code behind some spreadsheets and I need to loop through some code, like getting data from a database doing some formulas and moving the data to a new sheet. My code for getting the data from the database is getting all of the values in multiple columns where the data has not been reported and has the same fil...

Algorithm for finding a set of regions containing a cell

I am working with some spreadsheet data and I have a set of cell regions that are of arbitrary bounds. Given any cell, what is the fastest way to determine the subset of regions which contain the cell? Currently, the best I have is to sort the regions with the primary sort field being the region's starting row index, followed by its en...

Help me clear all my text boxes?

Hi I compiled the following little application only I want all the textpoxes cleard when the tabs areswitched by the user how can this be achieved? Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim FILE_NAME As String = "C:\test.pgp" If System.IO....

Hiding a sheet in Excel 2007 (with a password) OR hide VBA code in Excel

I found a way to hide Excel sheets which is as follows: set the visibility of the sheet to VeryHidden in the VBAProject properties and then password protect VBAProject properties. This is great, but in Excel 2007, if you save it as XLSX, the VBAProject password protection is stripped and you can view the VBA code. Is there any way to pr...

How can I distribute a number of values Normally in Excel VBA

Hi All, Sorry I know the question isnt as specific as it could be. I am currently working on a replenishment forecasting system for a clothing company (dont ask why it's in VBA). The module I am currently working on is distribution forecasts down to a size level. The idea is that the planners can forecast the number to sell, then can sp...

How Do I Convert an Excel XLS to an Access MDB using Excel VBA

I need to use VBA from Excel to load an Excel workbook in access and transfer it out to a database. Dim acc As New Access.Application acc.OpenCurrentDatabase "C:\Test.xls" I got that far and Excel crashes and has to restart. My plan was to use the following but I can't get that far. acc.DoCmd.TransferDatabase Any ideas? I've googl...

Extracting Unique values from a list

I have the following code that returns 50 random color-coded numbers: Sub RandomNumberColor() Dim Numbers, i As Integer Dim MyRange As Range Set MyRange = Worksheets("Rnd").Range("A1:A50") For i = 1 To MyRange.Rows.Count Numbers = Int((10 - 1 + 1) * Rnd + 1) Worksheets("Rnd").Cells(i, 1) = Numbers Worksheets("Rnd")...

Strange automation? error in Word2007

Hello all! I'm pulling my hair out because I've run into the following problem with one of my clients: My program uses extensive VBA automation in Word. Macros are saved in a specific Word template that is attached to each document. Some of the macros save the current document to a temporary folder under [User]/AppData/Roaming/... for ...

Looping through a all items in a field and updating another field using VBA in access.

I have two fields, one is just the number of the other one, e.g. Field 1 = "12AB" and Field 2 is "12". I'm trying to make Field 2 auto-update but I'm not sure how. I'm trying to get: ClassName ClassYear 12AB 12 13BU 13 15BE 15 But instead the whole fields update to the number in the last one: ClassName ClassYear 12AB...

Can I use custom XML parts in Word 2010 VBA?

I need to save some custom infos into a word 2010 document, I can use hidden texts, bookmarks, custom doc properties, content controls, etc, but all of these methods cannot work with large data very well, and these methods are fragile and are't very flexible. So I want to use custom XML parts, which can hold large data, and are flexible....