The code above will work but it is a bit slow - quicker to use the copyfromrecordset method of the range object as follows:
**********************************************
assume that you have defined an excel application, workbook and sheet (xlShtData), and you have a recordset (rst) that you...
Here is the code you need:
Function RemoveHeaderAndFooter(ByVal strOldFileName As String, _
ByVal strNewFileName As String) As Variant
'function removes header and footer from stroldldFileName
'creating strNewFileName and returning an array of the...
2 points:
1. If you are creating a query in code, and you do not need to access it within the user inrterface, then use the syntax:
dim qry as querydef
dim db as database
set db = currentdb
set qry = db.createquerydef("")
qry.sql = ........
'.......code to manipulate qry object...
This will do the trick:
Sub CloseAllInstancesOfExcel()
Dim objXL As Excel.Application
On Error Resume Next
Do
Set objXL = GetObject(, "Excel.Application")
With objXL
.DisplayAlerts = False
.Quit
End With...
No send keys please!
You need to use the end property of the range object - help is as follows-:
Returns a Range object that represents the cell at the end of the region that contains the source range. Equivalent to pressing END+UP ARROW, END+DOWN ARROW, END+LEFT ARROW, or END+RIGHT ARROW...
Keystrokes will depend on what system you are emulating.
Best way to find out is to use the Extra! macro recorder.
Once you have found the correct keystrokes you need to build a routine that sends the keystrokes and then waits until the screen shows what you need before continuing.
All the best
Copy the code below into a new module - hopefully should be self explanatory - if not post again!
Option Explicit
Private Const BIF_RETURNONLYFSDIRS = 1
Private Const BIF_DONTGOBELOWDOMAIN = 2
Private Const MAX_PATH = 260
Private Declare Function SHBrowseForFolder Lib...
You need the change event of the worksheet objectb - in project explrer double0click the appropriate worksheet and enter code like this:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const YELLOW As Long = 6
With Target.Interior
.ColorIndex = YELLOW...
Yes you can easily create indexes in Access:
In the user interface:
With the table in design mode, select the field that you want to index and then choose, as required, either "Yes (duplicates OK)" or "Yes (No duplicates)" in the Indexes section of the General properties...
When you initiall set up the connection to the ODBC source the dialog in which you choose tabloes to attach to has a "Save Password" check box - simply check this box and you will not be asked for a password each time you use the connection
If your legacy app is VBA compatable then you just need to create a reference to its object library file (.olb) and then maniplute its objects in the same way as other VBA apps.
If, which is more likely, your legacy app is not VBA compatable then you need a terminal emulator app such as...
Here is some code that does the trick - a few pointers:
1. Where a method requires range objects for arguments it is always safer to explicitly define the range objects - it will be immediately apparent if there is something wrong with a range
2. Use the "for each [object] in...
Assuming you atre using VBA with Excel:
1. In the VBA interface (Alt+F11) Go to Tools / Additional controls and select Calendar Control - this adds the Calendar control to the toolbox
2. Create a new userform (insert /Userform) - in the properties window give the from a relevant name (e.g...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.