This is a problem with Word as well. Setting your reference to Nothing (or just letting it go out of scope) does not close down the Office application; it just loses your link to it so you are left with an 'orphan' process. In either case, you must issue .Quit first.
I have a VFP6 exe incorporating a report including fields in currency format. On my and other NT4 machines, the report prints with £ symbols. On a Win2000 machine it is printing with $. In all cases, all regional/locale settings are English (UK). The exe was compiled with 'Use System...
I am using Excel 97 SR-2 on Windows NT4 SP6.
System regional settings are English (UK) with short date format of dd/MM/yy and long date format of dd MMMM yyyy.
My VB code is :
ActiveCell.NumberFormat = "dd/mm/yyyy"
ActiveCell.Value = "01/02/2003"
This displays as...
objExcel = CREATEOBJECT("Excel.Application")
With objExcel.Worksheets(1).UsedRange
For intRowNo = 1 TO .Rows.Count
varCellValue = .Cells(intRowNo, intColNo).Value
Next
End With
objExcel.Quit
Set objExcel = Nothing
Use an Image data type and populate it using the TextStream object (MicroSoft Scripting RunTime). You need to store the word document in C:\Temp (or somewhere similar) temporarily and then read it as a text stream. Recover it by the reverse process.
I have used this for document templates and...
Declare Function GetFullPathName Lib "kernel32.dll" Alias "GetFullPathNameA" (ByVal lpFileName As String, ByVal nBufferLength As Long, ByVal lpBuffer As String, ByVal lpFilePart As String) As Long
See http://www.vbapi.com for details - this is a very useful guide to calling...
It depends what you mean. Variables once declared remain until they go out of scope but it's not worth worrying about that. I would include range objects in the 'variables' category. If you are thinking about API objects such as device contexts, then they will stay around in the same way but...
Dim objExcel as Object ' Use late binding to be independent of Excel version
objExcel = CreateObject(Excel.Application)
With objExcel
...{Your existing VBA code} ...
.Quit
End With
Set objExcel = Nothing
I think you just need to join your tables in the one SQL as :
SELECT ed.Name, ed.Address, od.OfficeNo, od.TelNo
FROM Employees ed JOIN Offices od
ON od.EmployeeNo = ed.EmployeeNo
The code samples all include the key line :
Set xlApp = Nothing
If you don't do this, there still is a refernce to it and the app will remain in memory. In the case of Word, you MUST .Quit first as well. I don't know about Excel but it would be good practice anyway.
As a general point in...
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.