excel-vba

Installing a VBA macro in Excel 2007

I've got a VBA macro in an Excel 2003 spreadsheet and I'd like to 'install' it on a machine running Excel. I created a 'Trusted Location' on the local machine, and I know how to copy the module to the existing workbook and assign a key combination to invoke it, but I don't know how to make the macro appear automatically when someone s...

Can a worksheet object be declared globally in Excel VBA?

I'm refactoring a number of modules in an Excel 2003 workbook and the same set of worksheets are declared in each procedure in each module; I'd like to just declare them once globally. I can set the worksheet name as a literal, e.g.: Public Const xlwkGSModel = "gs_model" As String And then in the procedure use: ...ActiveWorkbook.Wor...

Data extraction with Excel

I monthly receive 100+ excel spreadsheet from wich i take a fixed range and paste in other spreadsheet to make a report. Im trying to write a vba script to iterate my excel files and copy the range in one spreadsheet, but i havent been able to do it. Is there an easy way to do this? ...

Where to cancel Application.OnTime in VBA

Using VBA in Excel 2003, I'm trying to cancel an Application.OnTime event using the following code: Application.OnTime EarliestTime:=varNextRunTime, Procedure:="SomeMethod", Schedule:=False where varNextRunTime is a global variable containing the next time it is due to run. This code runs in the Workbook_BeforeClose event handler so ...

vba userforms carriage return behavior

In a textbox of a userform in VBA, I would like to enable the feature where the user can add a new line in the textbox by pressing the "Enter" key on the keyboard. However, I had trouble finding a UI option in the UI editor to achieve this. Is this even allowed in VBA userforms? Thanks in advance for the advices and answers. ...

Excel Conditional Content/Formatting for Print vs. Screen and Page Breaks

I have a VBA publishing macro in Excel which generates a published workbook based on a master configuration worksheet and a number of worksheets with the data. The published version is straight data, still formatted, but with no formulas and with certain notes and background information suppressed. Basically, the master configuration c...

Visual Basic _ Question about findings the right study material?

Hey does anyone know of a great book/CD-ROM, etc for learn some novice to advanced Visual Basic study. I think I have about graduated the beginner stage. The main thing I need to do with Visual Basic is use it in conjunction with Office applications (2003 to be precise). Mostly MS Access, Excel and PowerPoint. But I want to learn more, I...

How to "order by" a column and "Include Column Name with query"?

Hi, I am trying to run a sql query in excel and I want to : 1. order the query result by my column "Stationname" 2. include the column names with the query Right now it is returning all the columns without the column name, and the end users do not know what it is. Could someone please help? I am stuck! Below is my current code: ...

VBA in Excel: Global Constants File

I'm working on some VBA scripts for an Excel worksheet, and I've created a module that contains a whole listing of mostly strings that store the name of each of my database fields. That way, if anyone modifies the database, they can update the VBA variable in the module, and then all my scripts, which reference the global variable instea...

Excel macro help - checking if boxes on left or right are populated

Hello I have an application that generates an HTML report that can be opened in Excel. I have written macros to try and format this report so it is sortable and can have filters applied. The length of these reports is impossible to guess as it can be larger some weeks, smaller others. I am trying to write a vba script macro in orde...

Excel VBA - Monitor all events that occur?

Using Excel 2002 and have a VBA "app" that has some UserForms. The main UserForm contains a number of textboxes that fire various Enter/Exit events. I am now running into a issue where one of the textbox exit events fires 2x in a row (I know because a messagebox appears each time). Is there some means within Excel VBA to track all the ...

vb code for excel-2007 format->recolor->set transparent color

hi can you show a vb code for excel-2007 format->recolor->set transparent color on an a image inserted... by the way, forgot to mention that excel-2007 record macro does not record this stuff otherwise i would not ask it here... :) ...

Refresh display of Range when ScreenUpdating is False

Hi Is there a way to refresh the display of only a specified range of cells from VBA, when ScreenUpdating = False? What I mean is the following: Application.ScreenUpdating = False Application.Calculation = xlCalculationManual Range("A1").Calculate Range("A1").SomeFunctionThatRefreshesThis ... Karl ...

Using "SELECT SCOPE_IDENTITY()" in ADODB Recordset

Using a VBA script in Excel, I'm trying to insert a new row into a table and then get back the identity value of that row. If I run: INSERT INTO DataSheet(databaseUserID, currentTimestamp) VALUES (1, CURRENT_TIMESTAMP); SELECT SCOPE_IDENTITY() in Management Studio, the row is inserted and it gives me the returned identity value as exp...

VBA Programming in Excel

I am new to programming in Excel. I have done very little Visual Basic. What I would like to do is check a column on one sheet in Excel and compare all the values to a column in a different sheet in Excel. Now the problem is, is it possible that when i click on one of the cells it is "linked" to the other and takes me to the matching cel...

How to programmatically remove the digital signature from VBA macros in Excel?

Is there any way to programmatically remove the digital signature from the VBA macros of an Excel sheet? i.e. code that is equivalent to entering the VBA editor, going to Tools menu -> Digital Signature and clicking Remove. ...

Excel 2007 Visual Basic Editor: eats spaces, throws cursor around

I can't resolve this issue, I found a similar question here but: setting the workbook to Manual calculation (alt-m-x-m or alt-t-o>formulas) didn't work Setting editor options to disable: Auto syntax check & Background compile didn't work anybody have any idea how to fix this very annoying behaviour, I'm used to quickly pop up VBA (al...

Process for updating Excel add-in?

I have an Excel 2003 add-in deployed in one of our departments that occasionally needs updated. What currently happens is that I publish the new version from my machine to a central location, this updates a version number stored in a database that the add-in checks each time any of the modules within it are run, and if a newer version n...

Stripping Uppercase Words in Excel VBA

Stripping Uppercase Words in Excel VBA I have an Excel sheet like this one: A B 1 Used CONTENT VERSION SYSTEM for the FALCON Project 2 USA beats UK at Soccer Cup 2008 3 DARPA NET’s biggest contribution was the internet 4 One big problem is STRUCTURED QUERY LANGUAGE queries on non-normalized data I ...

Modify an Excel Shape from Delphi

How can I modify the text of an existing excel shape from Delphi? I can create a new shape and set its text procedure TForm1.Button1Click(Sender: TObject); var excel, xlShape : variant; begin olecontainer1.CreateObject('Excel.Application',false); excel := olecontainer1.OleObject; excel.workbooks.open('C:\test.xls'); XlShape := ex...