vba

How can I execute a long running process in VBA without making pc crawl?

I have a VBA application that creates an instance of a COM object and then continuously polls the objects DataReady property to see if there is new data. When new data is available it sticks the data into a spread sheet. The problem is this macro (vba sub routine) continually runs and this slows down excel to a crawl and makes the comput...

problem with VBA apostrophes

Single line of code is causing my application to stop working - I think that the problem is with the apostrophes (maybe wrong escape): .Formula = "=IF(AND(" 'Criterion " & i & "'!" & cellAdress & ">=1;"'Criterion " & i & "'!" & cellAdress & "<=4);"'Criterion " & i & "'!" & cellAdress & ";0)" When I try to enter the "' sequence VBA aut...

VBA Error Handling not working in Excel

I have not had much experience with VBA, but I sometimes use it in work. Recently, I have encountered a problem that shouldn't happen, and that neither my boss nor myself can figure out. Basically, the issue is that the Application property DisplayAlerts is set to True by default, and can't be changed for some reason. Possibly related, ...

Pass data between event handlers in collection

I have a collection of event handlers of extended textboxes that handle the click event. On a click of any textbox in a column the event handler will unlock every textbox in that column by calling its form name and then sets a variable with an identifing variable in the active handler. Is there a way to set this identify variable inoth...

Can a VBA application Listen for events in a .NET class library through COM?

I have a class library that i made in C#.NET. The class has a public event, public event EventHandler DataReadyEvent; that is triggered periodically. I have a VBA application that creates an instance of this Class Library using CreateObject(...). I can access the methods and properties of the class library easially through COM but I can...

How to Access WindowsAccessBridge.dll in vba code

Hi, I read your post about "Not receiving callbacks from the Java Access Bridge" Could you please help me out regarding usage of "WindowsAccessBridge.dll" in vba Currently I am getting following error Bad DLL calling convention" when tried to execute following code Dim Var_g_HwndRec As Long Dim lb As Long Var_g_HwndRec = FindWindow...

problems with VBA code application or object error

I have coded some code in VBA my code breaks at this line raising Application defined or object defined error. .Formula = "=IF(AND(chr(34) & ' & chr(34) & Criterion " & i & "'!" & cellAdress & ">=1;chr(34) & ' & chr(34) & Criterion " & i & "'!" & cellAdress & "<=4);chr(34) & ' & chr(34) & Criterion " & i & "'!" & cellAdress & ";0)" ...

The control or subform control is too large for this location on resize

I have a simple form in Access 2003. The form has a List control and a button. I wanted to make the list to resize with the form (only vertically) while the button remains at the bottom right of the List. I'm using the following code on the form's resize event. list.Height = Me.InsideHeight - list.Top - 200 commandButton.Top = list.H...

insert date in a word document

Hi everyone, I'm working on a Word document which has a table on each page. Each table contains several occurrences of the word "Datum". By doubleclicking this word "Datum", this word should be replaced with the system date. And this date should be "frozen", i.e. it mustn't adapt itself when opening the document on a different day. ...

MS Access Skip function

I am creating a database on MS Access currently and was wondering if there was a way to program it to automatically skip over certain fields based on an answer in a previous fields? ...

VBA Transactions

I'm trying to insert some data into SQL from Excel VBA. The SQL commands are built up over the course of the VBA script, and include the use of some SQL variables. I'm trying to understand how transactions work in VBA, and whether they will work with what I need to do, I have the code below that will test this, but it does not work. It ...

MS-Access Cross-Form Support

I'm a .NET / C# software engineer who's been recruited into a temporary job function I'm not thrilled with. My company uses an MS-Access application for many of it's current functions. The Visual Basic version in use for this is (v6.5). The developer that assembled it (who's on vacation overseas at the moment) has a 'login' form that ...

simulation with rockwell arena

Hi guys, i'm doing a simulation model with arena, i need to develop some user-interfaces for my simulation using VBA, do you know good resources for studying this or some books i can read to get the knowledge? is there any other language i can use to do this? please guys help me out... i'm with no options stuck here! :( regards, Rangan...

Access VBA Question

I'm trying to use the below code to bring back all records that are not older than 90 days from a table Set PlatinumList = db.OpenRecordset("SELECT FORMATTED_CTN FROM CTN_LIST WHERE ((Status='Available') AND (Category='Platinum')) AND (In_Offer_List = True) AND (DATEDIFF(day, Created_DT, current_date()< 90);", dbOpenSnapshot, dbReadOnly...

VBA - problem with recognized variable in event handler

VBA - problem with recognized variable in event handler. in the event handler (click) i can't get the program to recognize variable j (it's local). when it get to the line: check.Value = MyCheck & j.Value it return : 'Mycheck1' only, even though its in a loop. i need the program to go throw all of the check buttons and check if they are...

Excel macro Auto start only in XLT file and not in XLS file.

I am using and XLT that contains macros, it creates an XLS by open, and save it in a choosen directory, the problem is, the saved file contains the same macros as the XLT. Is there any chance to modify the proc to make it save the generated file without the macros? best regards, Thomas ...

Access Report Size Uncontrollable!!!

Hi all, I have a report in Access 2007 that is opened by pressing a button on a form. This button triggers an OpenReport macro, where the report is told to open in Print Preview view, and Dialog window mode. How can I manually set the size of this window, along with the opening zoom level? In the properties of the report, both AutoResi...

problem with adding button in vba

I try to create a button on my spreadsheet with the following code Dim btnSaver As Object Set btnSaver = Workbooks(1).Worksheets("Results").OLEObjects.Add(ClassType:="Forms.CommandButton.1") I also tried Set btnSaver = Workbooks(1).Worksheets("Results").OLEObjects.Add("Forms.CommandButton.1") I first get message can't enter brea...

Access-VBA: Empty result for missing values in function?

Hi, I've got a question that probably has a pretty simple answer, but I didn't find a solution yet. Here's an example: Public Function abc(var_1 As Variant) As Single abc = 2 * var_1 End Function I want to call that function in an Access query. Values for 'var_1' are from a numeric (single) data field. Problem: Some the values for va...

How Do I Avoid using Running Totals in My Code?

I am learning programing and software design and Java in school right now. The class that is getting me mixed up is Software Design. We are using Word to run simple VB code to do simple programs. My instructor says I am losing cohesion by using running totals. I am having a hard time thinking of a way to avoid them. Here is an examp...