vba

Taking lot of time in excel report generation using VB

Hi, I am generating report in excel sheet(which is coming from Microsoft Access). For 100 records, it can generate the excel sheet in 2 to 3 seconds. But, it takes 10 minutes for more than 2000 records. Is there a solution or is there any other way to generate report in excel sheet? ...

error to create Excel object in VBA

Hello everyone, I am using the following code to create Excel object using VBA. I am using Office 2003. I run the following code in classic ASP. Set myexcel = CreateObject("Excel.Application") Error message is, any permission needed to create Excel object? Computer - default permission settings do not permit the address LocalHost (us...

VB.NET/COM Server code way slower than Excel VBA code

Background I have a client who needs Excel VBA code that produces formula values moved to VB.NET. He is in the business of providing financial analytics, in this case delivered as an Excel add-in. I have translated the VBA into VB.NET code that runs in a separate DLL. The DLL is compiled as a COM Server because, well, Excel-callable .NE...

Creating an .exe file from an excel spreadsheet

Can a standalone .exe be created from an excel file which has a few forms and macros? ...

Path for an AutoCAD file that contain an Excel file

I have an embedded Excel (.xls) file in a AutoCAD (.dwg) file. Using VBA (under Excel) I want to extract the path for the file that contains it (the path for AutoCAD file). ...

ms-access: instead of rowsource, running from query

i have a very complex query that is running from a listbox rowsource. i just do a listbox1.requery and it populates the listbox. instead of doing it this way, i would like to: i just want to save the query in the queries section call it from there. then i want to save the results of the query into a string then i want to feed the stri...

ms-access save query result in a string

I have a query saved in the queries section. I am running the query from VBA. Is it possible to save the results of this query to a string? ...

How to get the range of the visible rows after applying an advanced filter in Excel (VBA)

Here is the code that applies an advanced filter to the column A on the Sheet1 worksheet (List range) by using the range of values on the Sheet2 (criteria range) Range("A1:A100").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _ Sheets("Sheet2").Range("A1:A10"), Unique:=False After running this code, I need to do somet...

Difference between print and print preview events in excel vba

I have some code which intercepts the Before_Print event in excel to make sure that the user has filled in all the required fields before they print the sheet. However, I only want this code to fire when the user is actually printing, not when they are just calling the print preview. Is there any way to tell in the Before_Print code wh...

ShellExecuteEx in VBA

I understand how to use ShellExecute in VBA (for my Outlook macros) but I'm looking to be able to use ShellExecuteEx to wait for the executed program in my script. Does anyone have an example of how to do this? Currently I have this code: Const SW_SHOW = 1 Const SW_SHOWMAXIMIZED = 3 Public Declare Function ShellExecute _ Lib "she...

VBA to read hierarchical ini-like files/what are these files?

Hello, I am trying to find an efficient way to read through a report file generated by a machine where I work. I was reading this page about using the Windows API to read and write .ini files from VBA. I was hoping to use a similar approach on a different type of file, but I don't really know what this file is. It is a text report fil...

Superfast way to read large files line-by-line in VBA. Please critique.

I believe I have come up with a very efficient way to read very, very large files line-by-line. Please tell me if you know of a better/faster way or see room for improvement. I am trying to get better at coding, so any sort of advice you have would be nice. Hopefully this is something that other people might find useful, too, so it isn...

Error Handler - Exit Sub vs. End Sub

Why would I want to get out of an Error Handler (after handling) with an Exit Sub instead of just letting it go to the End Sub? I'm sure it's simple. I just don't understand. Thanks for any help. Example: Public Sub SubA() On Error Goto ProcError ''# other code MsgBox FuncA() ProcExit: Exit Sub ProcError: MsgBox Err...

Catching event when a link is clicked in a Textbox displaying richtext

In Microsoft Access 2007 the Textbox can be set to display a cut-down version of HTML as richtext. However, there does not seem to be an easy way to detect what has been clicked within the box itself. For instance, you can display a classic HTML <a> tag that appears as a link but clicking it doesn't generate any event. I'd like to know...

VBA - Accessing a collection of values

I have two access forms. frm_Main and frm_Sub which has data conditionally displayed depending on the selections of the main form. I need to write a select all function for items displayed in frm_Sub. In VBA is there a way that I can get a list of the id's currently being displayed in frm_Sub? for example, if I do this me.controls(...

What is a String[*] and how do I cast it?

I'm currently in the unfortunate position of having to call a VBA macro from C#, via the COM Interop. The macro returns an array of strings and looks something like: Public Function Foo() As String() which I'm then trying to cast to an array of strings in C# like this: var result = (string[])xlApp.Run("Foo", ... missing args ...) w...

excel with an SAS engine

is it possible to run excel with an SAS engine and run SAS code on it? the purpose of this i want to learn SAS a little bit and i dont want to buy it, so maybe i could use it through excel? ...

Access 2003 VBA Get Active filter?

is there a way to retrieve the active filter on a form via VBA? ...

Automate Importing Multiple Excel Worksheets into SQL

In VB6: I need to allow a user to select an Excel file, and then upload All Worksheets to a SQL table. I'm not sure how to do this. The format of each sheet is exactly the same. And the worksheet format matches the SQL table format. I'm really banging my head against the wall over here. If anybody could offer a suggestion, or a cod...

Excel vba: error hiding calculated field in Pivot table

I have written several Subs to show/hide fields in a PivotTable. Now I am trying to do the same with a calculated field, but I get an error when hiding it. I took my code from the recorder and the recorder's code also halts on the last line. I googled the error message, without serious result. Sub PrRemove() 'remove PR Dim pt As...