vba

How to find co-ordinates or Cell of picture object?

In Excel I have attached a picture to a cell using the following Sub InsertPic() Dim mPic As Picture With ActiveSheet.Range("D12") Set mPic = .Parent.Pictures.Insert("C:\abc.png") mPic.Top = .Top mPic.Left = .Left mPic.Placement = xlMoveAndSize End With End Sub Excel doesn't allow inse...

VBA Macro On Timer style to run code every set number of seconds, i.e. 120 seconds

I have a need to run a piece of code every 120 seconds. I am looking for an easy way to do this in VBA. I know that it would be possible to get the timer value from the Auto_Open event to prevent having to use a magic number, but I can't quite get how to fire off a timer to get something to run every 120 seconds. I don't really want...

Is there a workaround when hitting the maximum summands in =sum in an Excel formula?

I am hitting a limit when I try to assign a sum to a cells formula: cells(y,x).formula = "=sum(G65,H74,I38,J20,G22, .... ,K19,L22)" It seems as though I can't have more than 30 summands in a =sum formula. Is there a workaround for this problem? ...

How to check if a cell has a picture?

In Excel, I want to check if a specific cell for instance "C12" has a picture? How could I do this? ...

How can I remove blank line breaks from an excel cell with VB or a formula?

Hello, I have many cells where data is broken up into many lines; some of those lines are blank. Is there a VB function or formula to remove blank line breaks in Excel cells, or all line breaks? Many thanks! ...

Simple VBA/Macro need to create a new text file with the contents of active sheet without changing filename

I need to export data in a sheet to a text file without changing the file name (i.e. not doing "save as". Also it would be great if the file name could look at the previous like file name in the folder and increase by 1 digit (i.e. :file_1.txt, file_2.txt, etc.)... Thanks!! ...

SQL Error in VBA

Hey guys! I have the following code in SQL (2005) which calculates the avarage user logins on a systm: with user_total as ( select COUNT(distinct ID) as counter FROM [dbo].[LOG] where [LOG].DESCRIPTION='Login success.' AND Convert(datetime,convert(char(10),[LOG].CREATED_ON,101)) BETWEEN '2009-01- 01...

VBA error in excel

I have the following code: Sub Stats1() Workbooks("2006_2007_2008.xls").Sheets("Sheet1").Select Worksheets("Sheet1").Activate Dim my_cell As String my_cell = InputBox("Which cell?") Dim objConn As ADODB.Connection Dim rsData As ADODB.Recordset Dim strSQL As String Dim mycell As String szconnect = "Provide...

Gmail like "Send and Archive" in Outlook. How to get to the "parent" email when replying.

Responding to an email with the subject line "test", with this code... Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) If TypeName(Item) = "MailItem" Then Debug.Print Item.Subject Debug.Print Item.Parent End If End Sub ...returns this. Inbox RE: test I'm looking to get to "test", which is ...

VBA macro issue

Hey fellas, I have the following VBA code. It gets the values from an Excel sheet and saves them in a Tab-delimeted text file. However, it adds the column headers. How do I just get the values of rows say starting from row 2, cell A1 if the columns are in row 1, cell A1? Thanks. Sub DoTheExport() Dim FileName As Variant Dim Sep As ...

Ms Excel Problem Linking Range in Source Document to Custom Function in Target Document

I have some customer MS Excel VBA code (MS Excel 2007) that takes a range as input and then does some work on it (it is quite a large range). I want to use a separate excel document as the source of the range data. If I have both the source and target document open then the function works just fine. If I have only the target document ...

MS Access 2003 - Radio button : click one, unselects another

So what VBA can i use to make sure that is radYes is clicked, radNo is unselected? Just a measure to make sure that if one is clicked then other cannot be Thanks! ...

How can I get one dimension from a bi-dimensional array in VB.Net?

I have an application in VBA that gives to my VB.Net dll one bi-dimensional variant. It is a an array, in which every component is a another array containing two positions. I want to get this two-position array. When I am using VBA I can access directly the data from each position by doing: dataArray(index, 0) or dataArray(index, 1) ...

MS Access 2003 - Combine last record of multiple tables into one query or table??

I have a couple of tables that are transaction tables, and I would like to make a simple pivot chart for comparative balances....which happen to be the last record of each of these tables in a field called "balance". so i know how to populate this on a form using a SQL statement, rs.movelast, but i do not know how to get to the pivot ch...

What are the units for form widths and heights in VBA?

I'm programming VBA for Word 2007. I've created a UserForm which I need to resize with script. I noticed that its not pixels Me.Width = pixelW // form appears about 20% larger than the pixel width And its not twips either Me.Width = (((1 / TwipsPerPixelX()) * pixelW)) / 1) // form appears very small So how are form widths an...

Generating Jpegs from MS Access data

I run a pub, and we create a graphic for each football game, music event or rugby match that we have on, and it's piped in to all of our screens to market the event. What I'm looking for is a way to automate this graphic creation within Access, so a Jpeg of a certain size is created and dumped in a folder, containing text that's been siz...

excel vba, find a range

In excel, everyday i have to find where "spot" in the cell and then select after this row befor the cell containing "public". can any one help me How to find rows contains "spot" and end selection before containing cell "public". ...

How to delete all constraints from solver in Excel?

I can use SolverDelete to delete a constraint if I know exactly what it looks like. How can I delete all constraints with VBA without knowing them? ...

Receive a Jagged Array in VBA (VB6)

I currently have a VB.NET dll that returns a jagged array of double. This is the declaration: Public Function CalcMatching(ByRef dataArray1 As Object, ByRef dataLen1 As Integer, ByRef dataArray2 As Object, ByRef dataLen2 As Integer, ByRef matchingType As String) As Double()() It works well inside VB.NET, but when I insert it...

Can I get the current user from Active Directory LDAP using a VBA ADO Connection?

Is there any way to retrieve the user ID of the currently logged in user from Active Directory services using LDAP over an ADODB connection in VBA? I have only seen examples of how to query additional information about a user by specifying the user name and password. In those examples the user name is generally retrieved using Environ("...