vba

How Display Excel rows on selection of first Excel Column Value

Hi, I have Two Excel sheets. My requirement is when i select Reason Value From First Excel sheet Reason Column. It will display respected Reason Value in Second Excel. So using Macro i want to Display Second Excel Rows on selection of reason in first excel. Please Help. First Excel is And Reason Column Contains Reason1 , Reason 2 et...

Create XML from Access

Hi, We need to generate an XML using Access, is there any Visual Basic objects or functions that can help with the task ? Thanks in advance ...

Query string length limit in vba?

I am trying to combine multiple audit tables, and then filter the results into an excel sheet. The Union All and parameters make the query in excess of 1200 characters. It appears the string is truncated when running this. What recommendations can anyone make. I have no control over the database structure and am only reading foxpro free ...

Does VBA have an equivalent of "Text To" from Visual FoxPro

Visual FoxPro supports syntax such as the following: Text To VariableName TEXTMERGE noshow select * from..... EndText This assigns the value of all text between "Text To" and "EndText" to the variable. It eliminates the need for multi line statements separateed by "+ ;" Does VBA have something similar? ...

Calling a running C# application from VBA

I have some VBA code that needs to talk to a running c# application. For what it's worth, the c# application runs as a service, and exposes an interface via .net remoting. I posted a question regarding a specific problem I'm having already (http://stackoverflow.com/questions/2556163/from-vb6-to-net-via-com-and-remoting-what-a-mess) but ...

How do I use a .NET class in VBA? Syntax help!

ok I have couple of .NET classes that I want to use in VBA. So I must register them through COM and all that. I think I have the COM registration figured out (finally) but now I need help with the syntax of how to create the objects. Here is some pseudo code showing what I am trying to do. EDIT: Changed Attached Objects to return an Arr...

intellisense functionality in a custom VBA function?

In the standard IDE for VBA, intellisense is built-in to many standard VBA functions. i.e. the buttons variable for msgbox() gives you a list of options for how you want the messagebox to be displayed. This way, the developer doesn't have to memorize or look up the options every time function is used. Can I achieve the same for my cus...

percentage formula in crystal report 8.5

I am doing one project using vb6.0+access+crystal report8.5 some error occur during the crystal report. Query Name seqquery: SELECT segment_trans.division_name, sum(segment_trans.Total_value) AS total, division_master.Target FROM segment_trans, division_master GROUP BY segment_trans.division_name, division_master.Target; cr...

How do I correctly use two Not Exists statements in a where clause using Access SQL VBA?

I have 3 Tables: NotHeard,analyzed,analyzed2. In each of these tables I have two columns named UnitID and Address. What I'm trying to do right now is to select all of the records for the columns UnitID and Address from NotHeard that don't appear in either analyzed or analyzed2. The SQL statement I created was as follows: SELECT UnitID,...

How do you set the "global delimiter" in Excel using VBA?

I've noticed that if I use the text-to-columns feature with comma as the delimiter, any comma-delimited data I paste into Excel after that will be automatically split into columns. This makes me think Excel must have some kind of global delimiter. If this is true, how would I set this global delimiter using Excel VBA? Is it possible to...

Mass saving xls as csv

hi, here's the trick. gotta convert 'bout 300 files from xls to csv, wrote some simple macro to do it, here's the code: Dim wb As Workbook For Each wb In Application.Workbooks wb.Activate Rows("1:1").Select Selection.Delete Shift:=xlUp ActiveWorkbook.SaveAs Filename:= _ "C:\samplepath\CBM Cennik " & ActiveWorkbook....

Using Excel VBA to Create SQL Tables

Hi All, I am trying to use Excel VBA to automate the creation of a SQL table in an existing SQL Database. I have come across the following code on this side. Private Sub CreateDatabaseFromExcel() Dim dbConnectStr As String Dim Catalog As Object Dim cnt As ADODB.Connection Dim dbPath As String Dim tblName As String 'Set databas...

Can I have a macro run whenever I save a file in Visual Studio 2005?

When I save a file in Visual Studio 2005, I'd like to have a macro also run that updates a copyright (through a regular expression search and replace). I'm not new to regular expressions, but I am new to VB/VBA and Visual Studio macros, so what I need help with specifically is: getting a macro to run upon save, preferably after I pres...

Excel VBA SQL Import

Hi All, I have the following code which imports data from a spreadsheet to SQL directly from Excel VBA. The code works great. However I am wondering if somebody can help me modify the code to: 1) Check if data from column A already exists in the SQL Table 2) If exists, then only update rather than import as a new role 3) if does not ...

Excel VBA to Create SQL Table

Hi All, I have found the following code which is suppose to create a SQL table within a SQl Database. The database is specify in dbpath and the table to be created is in tblname. However when i run this code i have a problem finding to right SQL database. For example if i specify the dbpath as "WIN2k8\Test\ABC" ie the machine name i...

Can I have a macro in Visual Studio 2005 call a DOS command and redirect the output to a file?

I'd like to have a macro in Visual Studio 2005 that calls a DOS command and redirects the output (stdout and stderr) to a file. Just calling the command and ">" redirecting it will not capture stderr, so there are two parts to this: calling a DOS command capturing both stderr and stdout to a file during that call I'd then like to o...

Excel VBA SQL Data

Hi All, I have a small excel program. I would like to be able to use this program to update a SQL table. What would be the function to say update line 2 in SQL table Test in Database ABC Thanks ...

How to code an ALL option into a Combo Box

I have a combo box on my form with the choice of choosing organization 10, 20, 30.... I have added ALL to the combo list box, but am having trouble implementing an all statement in VBA. Below is the case statement I have to get info from organizations 10, 20, 30. How do I get ALL to generate?? Case Is = 1 If cboOrg.ListIndex < 0 Th...

vba Loop over a non-contiguous range

I have a non-contiguous range on rows (example address of myRange: $2:$2,$4:$205,$214:$214) and I would like to access a specific row and column within the range. I have tried the following: 'Get the value of the 2nd row, 1st column within the range myRange.rows(2).Cells(, 1).Value However, this is giving me the value of the 2nd row ...

Excel VBA to Update SQL Table

Hi All, I have a small excel program that is use to upload data to an SQL server. This has been working well for a while. My problem now is that I would like to offer to users a function to update an existing record in SQL. As each row on this table has a unique id columne. There is a column call UID which is the primary key. This ...