vba

Excel VBA or Function to extract Workbook name and data from workbook.

Is there any way to extract the workbook name, but then extract only a part of it. Any version of excel would be fine preferably 2003. For example "Help_TicketID123456788.xls" "Help_TicketID563565464.xls" ... So then I'd like to extract the ID numbers and put them into a column on a master worksheet in another workbook. Additi...

How to save a copy of an inactive worksheet - Excel 2003 vba

We have a piece of software that allows the user to run a report. The template for this report is an Excel workbook that exists on a network drive. The steps are: The user clicks "Generate Report" The software opens the template, populates the data, and closes the template, saving it in a specific directory. This is done "silently", ...

Excel summary of many excel files data into one report excel

Hi I have a number of excel files containing filled survery, now I would like to have one master document that would have summary result of each. Thus I imaging to have for each file a row input: name - address - some data... I would like to open each of the files, and copy the data from selected cells into my master file. I have ...

A little Access VBA help? Validating against duplication of a non key field?

I am adding a part name to the database using a form, What code do I put behind the Add part button to validate against duplicate part names? (part number is the primary key) I think I need another recordset to search and compare the table but i'm a bit lost, any help would be great. Private Sub btn_add_Click() rs_parts.AddNew With rs_...

VBA get list of available languages on current machine

I have a muulti-language Access application that needs access to languages/keyboard layouts installed on the machine. I have certain fields that accept input in various languages. I would like to be able to change the active language/keyboard layout when these fields are entered and exited. I'm sure that there is some sort of windows AP...

Error when reading registry with Visual Basic 6 running on Win7

Hi I have inherited a VB6 application from a friend of a family member, who wants to have some enhancements done to it. I haven’t developed in VB for more than 3 years (I’m currently developing in MS Dynamics Ax). I’ve recently upgraded my hardware and am now running Win7. The last time I worked with the app (about a year and a half ag...

Problems with Excel export to Word using VBA

Hi, I'm having problems exporting data from Excel to Word. In the Excel sheet, there is a command button which first sorts the data according to date (this works). Then, the content of these columns (which are declared as variables after the sorting is done) should be exported to a Word document. Opening a word file works, and the firs...

Changing data in child iFrame issue - can't obtain a DOM object.

Hi, guys. For some reason I'm trying to parse this website: http://www.vblandrecords.com/index.aspx. I am currently trying to click Document type tab and then change From date value. I supposed I could have done it with the following code, in VBA: Option Explicit Public WithEvents ieObj As InternetExplorer Public Sub Launch() Se...

Select method of Range class failed via VBA

This is the code that I'm currently working with, and I'm getting this problem. I'm novice at Excel and I can't figure out what's wrong. Private Sub cmdRecord_Click() Sheets("BxWsn Simulation").Range("Result").Select //This is the line with the problem, as excel told me. Selection.Copy Sheets("Reslt Record").Select Sheets("R...

Book list - getting book details from amazon using Excel VBA barcode lookups

I have a barcode reader and bunch of books. For each of the books, I want to list the book name and the author in an Excel spreadsheet. My view is that some VBA code connecting to an Amazon web service would make this easier. My questions is - hasn't anyone done this before? Could you point me to the best example. ...

Get macros written in Word 2003 to function in Outlook 2007

I've been asked to find out how to get a collection of Word macros that used to run in Outlook 2003 running with Outlook 2007. If there is no way to do this, I will need some different options on what to do with them as apparently Word is not an option to use as an editor anymore in Outlook 2007. Other than rewriting them all, what can ...

Need Help Using INDEX and MATCH with a Dynamic Named Range

Hi I have 2 ListBox's (Purchase_Select_Debtor) & (Purchase_Select_Quantity) on a Userform with a txtBox for Price (txtPrice). The Code uses Index and Match to return a result based on the Debtor and Quantity Selected. Below is my current code which works fine, but every time I add a new Debtor I have to alter the code to change the Ph...

Please help, Excel ADO OLEDB SQL Statement problem

I'm reading from an excel XLS worksheet with no header rows. Some cells in the column have a list of numbers like 12345,12346,12347,12348. Other cells only have one number 12345. The "LIKE" operator finds the number when there is multiple numbers in a cell, but doesn't find the cells where only one number exists. SQL = "SELECT * FROM [...

VBA: How to display an error message just like the standard error message which has a "Debug" button?

As usual, I create an error-handler using On Error Goto statement, there I put a few lines of cleaning codes and display the error message, but now I don't want to lose the comfortableness of the default handler which also point me to the exact line where the error has occured. How can I do that? Thanks in advance. ...

Access VBA - How would I have a loop in VBA that allows me to loop through control names

So I have like 10 text boxes on a form that are actually used for display not entry. They are are named like txt_001_Name, txt_002_Title, etc..what kind of loop is used for this. I was wondering what kind of VBA would I use to actually loop through the names of the text boxes. So if I was to debug.print it would look like: txt_001_Titl...

I Need VBA Library References

I'm doing a gig where there is a need to write a few simple VBA macros for Word and Excel. This is a skill I haven't used in about 8 years -- and things have changed! Aside from the little detail that VBA is clearly in legacy mode, with minimal support, there's all the new security measures designed to close VBA as a malware vector. Mos...

ShellAndWait not working

I'm using ShellAndWait from here http://www.cpearson.com/excel/ShellAndWait.aspx and I keep getting 1 returned (which means the command didn't work in Windows). But when i paste my cmdLine into Start, Run box it runs fine. Any ideas? I'm using Excel VBA for this and here's my code that I'm calling ShellAndWait with What am I doing wrong?...

Access return value from VBA Function in .NET?

I have the following code in VBA (which resides in an Excel 2007 Workbook): Public Function Multiply(a As Double, b As Double) As Double Multiply = a * b End Function If I invoke Multiply from other VBA code, it returns the correct value. However, when I call Multiply from C#: var excel = new Application {Visible = true}; excel....

How to get the string from an address specified by a long in VB

In vba, There is an address held by a long type which points to a null-terminated string, but I can't find a way to get the string from this address: long str_address = ... string str = ? Would you please shed some light on this? ...

return a list of all macros

In vba, how can i call a word document and get a list of all the macros it contains. Thanks ...