vba

How do I check if an Excel cell's Date is within one week?

I'm using VBA in Excel 2010 to make a simple birthday reminder program. I have a column of dates (Column D). How do I check if a cell is within one week of today? I'm not sure what the VBA syntax for the conditional statement would be: For i = 2 To MAX_ROW cell = ActiveSheet.Cells(i, 4) If (Date(cell) - Date(Now()) <= 7) Then ...

Get Error message when passing arguments to a vba function: "Argument not optional (Error 449)"

Hello, I am trying to retrieve an ADODB recordset from a function in MS-Access 2007 but get a very annoying error message thrown in my face saying: "Argument not optional (Error 449)". I really can't figure out what I am doing wrong, please help! Regards, Stefan FUNCTION: Function Rs(sourceSQL As String) As ADODB.Recordset ' Creat...

Export / copy Access Pivot Table View to Excel 2003?

Is there a way to copy an Access 2003 pivot table view (used to pivot 206,000 records) to Excel 2003 using VBA? ...

How to run a SQL Query from Excel in VBA on changing a Dropdown.

I'm trying to create a dropdown that upon changing the selection from the list of options will run a query that will insert the query results into the page. Here's what I have thus far: Sub DropDown1_Change() Dim dbConnect As String Dim leagueCode As String Dim leagueList As Range Dim leagueVal As String Dim TeamDat...

Excel 2003 VBA fails to call SQL sproc with temporary tables

I am trying to get resultset from SQL 2008 sproc into Excel 2003 using VBA. It worked for few sprocs but when I tried the one which uses temp table or table variable VBA fails with err 3704 "Operation is not allowed when the object is closed" on the following line: Sheet1.Range("A2").CopyFromRecordset rsMyDB If I comment out select i...

VBA. How to find position of first digit in string

I have string "ololo123". I need get position of first digit - 1. How to set mask of search ? ...

VBA. Array for search or replace

Need to found any symbol of array. For example: replace(string,[a,b,c,e,f,g],"a1b2c3d4e567"); result = "1234567" How do it ? ...

Excel VBA: How do you format Charts in Excel with New Data?

Hi, I'm trying to make a macro that formats a chart in Excel 2003 where the data changes. Basically, I have a 20 X values and Y values at all times; however, the values are data specific (I'm making stock price charts that will change depending on the stock I'm analying). I'm trying to make my Y-Axis cross the X axis at the value in ce...

Programmatically extract embedded file from PowerPoint presentation

I am working on a VSTO PowerPoint add-in which involves recording and playing sounds. I was requested at the last minute to allow users to pick the device that will play the sound, like Skype does. In general, I don't think it is possible to specify what device PowerPoint should use, except by selecting the default device in the contr...

vba: getting computer name

is there a way to get the name of the computer in VBA? ...

vba: object variable or with block variable not set

i am doing this: MsgBox ActiveWorkbook.Name and getting the above mentioned error. please note that this has worked for many months and now all of a sudden it does not workl what can i do to fix it? ...

count and remove duplicate access vba

Here is some code I have to remove duplicate occurances of catid & recid in tblcat1_rec table, leaving only 1 entry: mysql = "DELETE FROM tblcat1_rec " mysql = mysql & " WHERE ID <> (SELECT Min(ID) AS MinOfID FROM tblcat1_rec AS Dupe " mysql = mysql & " WHERE (Dupe.catid = tblcat1_rec.catid) " mysql = mysql & " AND (Dupe.recid = tblcat1...

access vba extract phone & fax in address column of table

I have a table with phone & fax data in an "address" column that I want to put into their separate "phone" and "fax" column. The phone comes in a various forms: phone, T , ph, tel., tels., fono. The same issue occurs with fax, i.e. Fax & F. Ideally, I think the following is a good description of the data. Not all numbers pertain to p...

Python to control macros in mutliple instances of Excel.

How Do control with python multiple instances of Excel. This is not read/write, but more running macros on different workbooks. Ex: Excel.exe running Book1.xls. has mac1 Excel.exe running Book2.xls. has mac2. I got one instance to work, this first instance, which use 2003. I could not figure out the other instance which is 2007. I...

SQL Server stored procedure vs an external dll

I am trying to convince someone that using an external DLL to manage sql data is better then using stored procedures. Currently the person I am working with is using vba and calls sql stored procedures to get the complicated data they need from many different sources. It is my understanding that the best way to go about this kind of acti...

What if any links exist to free Excel "helper" class libraries for C#?

I'm looking for any available free Excel "helper" classes that are written for .net (doesn't have to be C#). I'd like to evaluate what others consider to be useful and generic static (and non static) helper methods. Can be targeted at VSTO or regular Office automation, although that probably doesn't matter. I guess I should also point o...

accessing SmartArt shapes when the SmartArt is inside a Placeholder (powerpoint 2007)

I need to go through each shape of a smart-art in PowerPoint 2007. When shape.Type=msoSmartArt then I could simply go through the shapes in shape.GroupItems. However, when shape.Type == msoPlaceholder && shape.PlaceholderFormat.ContainedType==msoSmartArt then shape.GroupItems is empty. How can I access the smart-art shapes in such a cas...

How do you make a macro in excel not show the selections being made.

I know there's a property to add in the beginning of the macro so that all the selections and deselection happen in the background and are not shown on the sheet. I think I had to disable some property at the beginning of the macro and enable it at the end. Does anyone remember what it was? ...

How to make cells readonly in spreadsheets

I'm populating a spreadsheet with Database values.The cells that I fill data with,I want them to be only read only to the users.How can I do this ...

Passing a VBA Collection of String Arrays (Variants) as a List of String[] Arrays to a C# COM interop object?

I have a C# COM interop object that accepts a List of String[] arrays. Trying to pass something that somewhat resembles a List of String[] Arrays to be passed from my VBA Access 2000 application, to my C# COM object. I already have the object written out and I'm a little frustrated because I know little about VBA. Thank you in advanced! ...