vba

Trying to use VB to automate some queries. Running into what looks like a string problem

Hi there I'm using MS Access 2003 and I'm trying to execute a few queries at once using VB. When I write out the query in SQL it works fine, but when I try to do it in VB it asks me to "Enter Parameter Value" for DEPA, then DND (which are the first few letters of a two strings I have). Here's the code: Option Compare Database Public S...

Call a Subroutine from a different Module in VBA

Can I call a function from one Module to another? I wrote the following: Sub MAIN() Call IDLE End Sub "Main" is located in "Module1". "IDLE" is located in "Module2". (defined as: "Sub IDLE()") Thanks. can this be done? ...

Problem with a "Select Case"

i wrote the following section below. when debugging, i see that i enter the first Case okay. my problem is with the second Case - it does not enter it and goes to the error messege. what do i do wrong? Select Case Data_Rate Case "1", "2", "5.5", "11", "6", "9", "12", "18", "24", "36", "48", "54" a = Data_Rate Select Case Dat...

Outlook rule to run VBA script that runs external program

I've set up an Outlook rule that filters for the emails I care about. The action I want to take is to run an external program (python script) to parse each such email. Can someone advise on how to do this? I know of the SHELL function, but I need a way to pass the body of the email to my external program. I have zero experience with ...

Call a VB macro from java code

I have a VB macro created. I want to pass the macro a string and a file location. How would I call this in java code. Is there a library for this? ...

why should i use single quotes for application.run in excel?

i have this: Application.Run ("'L:\database\lcmsmacro\macro1.xlsm'!macro_name") why should i use the single quotes? does it not recognize the backslash? ...

ms-access: report that displays records only within a certain date

i have a very simple report that is generated from just one table. one of the columns in the table is a date. i need to be able to allow the user of the report to enter a range of dates and display data only between those dates. how do i do this>? ...

VBA: Validate List settings

Sub Macro1() ' ' Macro1 Macro ' ' Worksheets("Drop-down").Select For i = 1 To 10 ActiveSheet.Cells(i, 2).Select With Selection.Validation .Delete ' Error in this line .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:=Range(Wo...

VBA: jumping out of a for loop

How do I achieve the following? Sub Macro1() ' ' Macro1 Macro ' ' Worksheets("Drop-down").Select n = Cells(1, 1).End(xlDown).Row For i = 1 To n ActiveSheet.Cells(i, 2).Select ******************************************************* If Worksheets("Misc").Cells(2, i).Value = "" Then continue...

Hide command button on word doc

Hi I have a .doc with a command button (cmdStart) which opens a form. After populating the form I click a button to close the form and populate the .doc. I want to hide the initial cmdStart on the .doc as well when the form closes, Ive tries document.shapes(1).visible=false and cmdStart.visible=false but none seems to work. Any ideas?...

DLL Needed For Excel VBA Sleep()?

When using: Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Is it required to have some sort of DLL? If so, which DLL and where can I obtain it? ...

Sorted list of file names in a folder in VBA?

Is there a way to get a sorted list of file names of a folder in VBA? Up to now, I arrived at Dim fso As Object Dim objFolder As Object Dim objFileList As Object Dim vFile As Variant Dim sFolder As String sFolder = "C:\Docs" Set fso = CreateObject("Scripting.FileSystemObject") Set objFolder = fso.GetFolder(sFolder) Set objFileList = o...

10 users need to be able to run the same macro in excel

i have a server where resides an excel macro there will be about 10 users on 10 different workstations that will need to run that macro on their own worksheets. how do i run the macro from a centralized location by multiple users who want to run it on their own worksheets? the reason i need it centralized is because the macro will nee...

Using "wildcards" in a vlist array to delete rows in Excel

Good Morning All, I'm trying to setup a vba macro to delete all user IDs out of a spreadsheet that do not start with designated prefixes (e.g. US, A1, VM, etc). The below block of code was found on the Code Library and looks to be what I need but there is one problem: When I enter in UserID prefixes into the vlist fields, it treats them...

creating an excel add-in

can someone please get me started on the following: i would like to package an excel macro as an add-in to excel. the macro will reside on a central computer, where 10 other computers will connect to. how do i create an add-in that will be constantly updated ? ...

access: sql statement is not sorting for some reason

my report is generating data that is supposed to be sorted by date and is within a specified date range: SELECT * FROM [lab occurrence form] WHERE ((([lab occurrence form].[occurrence date]) Between [Forms]![Form1]![Text2] And [Forms]![Form1]![Text4])) ORDER BY [lab occurrence form].[occurrence date] DESC; i have two textboxes which c...

ms-access: date/time data type

i have a table that has a date/time field when i display the report, should i make this column a GENERAL DATE? or something else? i am having problems sorting ...

ms-access: difference between control source and row source

i have learning reports in access and i don't understand the difference between these two concepts. i understand that the control source is the column? but then what is the row source? ...

How to pass a word macro a String parameter

I would like to call a word macro from a java program and pass the macro a search string. Is there anyway to do this? ...

vba: read only first 1000 characters of file into string

i need to open a txt file and read it into a string in VBA, but i would like to only get the first 1000 characters. the file itself is 20mb and i only need the first 1000 characters. is there a way to make this efficient? ...