|
-
Jul 22nd, 2005, 07:33 AM
#1
Thread Starter
Junior Member
Question about Public types, functions, etc
Hi all.
I have a program that calls Excel from another application, does some data processing and closes Excel. For some extremely mysterious reason, the system doesn't remove the Excel object from memory after the application has run.
I have checked, double checked, triple checked, quadruple checked, quintuple checked.. you get the idea. I am releasing all Excel related objects. I don't have any "global" references to Excel, I've used late binding on all the Excel objects, etc.
I'm only left to believe that it's something entirely not related to Excel that is left as a remnant that prevents my program from being completely removed from memory.
My best guess is a little module that declares an open file dialogue function from the comdlg32.dll. Being completely new to programming I didn't write this function and only understand enough of how it works to get what I need.
So, aside from a possible solution to my problem, I'm also looking for an explanation of type defining, public v. private function declaration, and all the other things included in the sample code below.
I am including the declarations section of the module. This seems to me to be the root of my problems and lack of understanding..
VB Code:
Option Explicit
Public Type WinFileName
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As Long
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Look
plTemplateName As String
End Type
Public Declare Function GetWinFileName Lib "comdlg32.dll" Alias _
"GetOpenFileNameA" (pWinFileName As WinFileName) As Long
Public Declare Function GetSaveFileName Lib "comdlg32.dll" Alias _
"GetSaveFileNameA" (pWinFileName As WinFileName) As Long
Public Const OFN_ALLOWMULTISELECT = &H200&
Public Const OFN_EXPLORER = &H80000
Public Const OFN_FILEMUSTEXIST = &H1000&
Public Const OFN_HIDEREADONLY = &H4&
Public Const OFN_PATHMUSTEXIST = &H800&
There it is. So I'm thinking that because these things are declared as public, they aren't going out of scope and causing my program to poo poo out.
Thoughts?
Thanks
-
Jul 22nd, 2005, 09:26 AM
#2
New Member
Re: Question about Public types, functions, etc
Is there any reason you're not using Excel VBA's builtin File Save and File Open? This would probably be a simpler way to do it.
I would imagine that somewhere within the "calls Excel from another application, does some data processing and closes Excel" part of your code could be the issue. Can you post this code?
thanks
sugarflux
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|