vba

How to access a constant defined in another Excel workbook?

Question How do I access a public constant defined in another Excel workbook? Setup Workbook.xls My VBA code runs in the current Excel workbook called "MyWorkbook.xls". It has some VBA code in it which reads a file name --"OtherWorkbook.xls in this case-- from cell "A1". Then, the code should read a constant defined in that other wor...

If [ComboBox] Is Null Statement in VBA/Access 2007

Hi all, I have a form with 1 combo box (YearToBeBuilt) and 2 text box fields (Cost and YearofExpenditureCost). All controls are linked to a main table and the table is updated once the selections/entries have been made on the form. I have written a procedure in VB called ReCalcIt()which performs the following procedure when called: ...

VB(A) : looping to find previous sheet

Hi In Excel, i have sheets named after the working day. So, I don't have weekends nor special days (holidays and so). I've created a function : previous(x), with x the number of days worked. I want my function to give me the date (mm-dd format) of n-x day, n is the current sheet's day edit: sorry day1 and month1 because day and month ar...

How to trim text in a column with VBA - Excel

How can I trim a the text in each cell in a column? If the syntax is like: "[email protected] (name name)" and I want to delete "@twitter.com (name name)" from all cells in the column being left with only "blabla" in the cells. Any ideas? ...

Identify whether 2 excel documents share the same structure

Hi , I need to find a way to identify if 2 Excel documents are basically based on the same nomenclature. The first document need to load data from the second one. And I want to make sure that the first document is correctly trying to load relevant data. Is there a clever way in order to do so ? My very primal thinking at the moment...

Exchanging variables between powerpoint and excel VBA

I have a powerpoint pres that grabs some data from an excel sheet when a button is pressed. Set EXL = New Excel.Application EXL.Visible = False Dim XLApp As Excel.Application Set XLApp = GetObject(, "Excel.Application") This is how I set the new excel application. What I'm wondering is how I can send over a variable from my powerpo...

Get Name of Current VBA Function

For error handling code, I would like to get the name of the current VBA function (or sub) that the error occurred in. Does anyone know how this could be done? [EDIT] Thanks all, I had hoped that an undocumented trick existed to self-determine the function, but that obviously doesn't exist. Guess I'll stay with my current code: Option ...

Create an Outlook 2003 toolbar using VBA

Hi, In Excel 2003 I can access the collection Application.CommandBars to create custom toolbars using VBA. Is there an equivalent in Outlook 2003? I am trying to change the labels on buttons of a customer toolbar. In the future I'd like to create the toolbar from scratch. Cheers, Dave --Trindaz on Fedang #Outlook-vbas ...

Ms Access frontend, PostgreSQL backend efficient INSERT INTO ... RETURNING ... statement

HI, I'm using MS Access as a frontend to PostgreSQL database. And I have run into dead end: How would I get return value of passthrough SQL INSERT statement? I tried something like this: strSQL = "INSERT INTO someTable (col1, col2) VALUES ('val1', 'val2') RETURNING col0" 'Create passtrhough query dynamically (another function) Create...

MS Office Webservice toolkit for Office 2007 ?

There is an article here for MS Office 2003 http://metrix.fcny.org/wiki/display/tips/How+to+Create+a+Microsoft+Access+Client+for+a+SOAP-based+Web+Service+API When I tried to install http://www.microsoft.com/downloads/en/details.aspx?FamilyID=fa36018a-e1cf-48a3-9b35-169d819ecf18&DisplayLang=en it says it requires Office 2003 whereas ...

oAuth client in Office VBA what is difficult ?

I cannot find any oAuth sample code and saw others were desperately searching for it, what's the difficult part to implement an oAuth client in VBA ? ...

Loan Amortisation Loop in VBA

Hi, I need to create a cumulative cash flow schedule for a pool of loans in vba and was hoping for some help?? I can create amortisation schedules in Excel for single loans but I would need something to run schedules for 000's of loans in one execution....I.e Starting with a spreadsheet containing loan level information (interest rate...

Modifing an X-Header on Outlook using a VBA Macro

Hi all, I need to write a OutLook macro to read a special email header ("X-SpecialMe") and modify it. How is it possible to modify an X-Header on OutLook? Can you modify it before sending an email (inside a VBA event, for instance)? Thank you! ...

How to get value from textfield in powerpoint into excel?

How could this be done? The powerpoint application is running and the textfield i want to get the value from is on slide3. I've tried this without any success: Dim PPApp As PowerPoint.Application Set PPApp = GetObject(, "PowerPoint.Application") Range("A20").Value = PPApp.Presentation.Slide3.txtMyTextField.Value Anyone know the rig...

Making a macro runs automatically in Outlook

Hi All, I wrote a macro in VBA that does an action on some of the files that arrive to my inbox in Outlook. However, I will have to click a button or a shortkey to run this macro. Is there a way that this macro runs automatically whenever an email arrives to my inbox? Please help, ...

VBA Findnext Issue

This code works until input the coding between the ********** I'm trying to do two different searches at the same time. Can someone explain what I'm doing wrong? Thanks Public Sub Swap() With Sheet1.Range("A:A") Set LastCell = .Cells(.Cells.Count) End With Set FoundCell = Sheet1.Range("A:A").Find(what:=cusip, after:=LastCell) If...

Save Excel 2003 worksheet into an Access 2003 table

I'm trying to write a macro to export a single row from a single worksheet from an Excel 2003 workbook to a new row in an Access 2003 table. I'm new to VBA, and everything I've found on the web refers to going the other way -- from Access to Excel. I want this to be an export, not a link, and I don't care about keeping them synced afte...

casting COM objects in VBA

I have a base abstract class MyClass, and it has an interface IMyClass. I have 2 other classes (MyClassA, and MyClassB) that inherit from MyClass and include the IMyClass Interface. I have a fourth class (MyList) that inherits from List<IMyClass> and it has an interface that has a method Add(IMyClass value); All classes have been ...

Is there ever more than 1 Explorer object in Outlook.Explorers in Outlook 2003?

Hi, I've noticed that no matter how many times I try opening new instances of Outlook (which I haven't actually been able to do) or browse around to different parts in the application, there's only ever one Explorer in the Outlook.Explorers collection when iterating in some VBA code. Why is there a collection at all to house these? When...

Excel VBA - Using Ranges as Optional parameters for functions?

I'd like to write a VBA function that has a Range as an optional parameter. For instance something like: Public Function testfunc(S As String, Optional R As Range) As String testfunc = S For Each cell In R testfunc = testfunc + cell Next cell End Function I tried the function above, but I get a #VALUE! error. I also tried wrapping the...