|
-
Sep 26th, 2000, 05:17 AM
#1
Thread Starter
Addicted Member
Help needed urgently !!!
I am at a loss with References, How do you make them....
I have written quite a lot of code in Excel VBA, my problem is that when I move the spreadsheet to another computer I get lots of problems with the references.
I look in the references box and some of them are missing.
My solution:
Copy the files across from my computer to theirs... WRONG !!
Could anybody provide a link or help so that I can understand what it is that is going wrong and which files are required....(i.e. the dll, ocx etc.etc..)
Another issue is that when I copy a (for example dll) across and browse for it in the reference box, when I add it in the open dialog box, another reference is added... Not the one I wanted. WHY IS THIS ??
Please help
Steve
-
Sep 26th, 2000, 05:24 AM
#2
Addicted Member
Hi,
You've almost got it 
When you move the files (Dlls) across to the other computer, you then have to register them!
Example:
first copy my.dll to c:\my.dll on your other computer.
then, on that computer, goto to Start>Run to open up the command line and type in: regsvr32 "C:\my.dll".
Your component will then be registered and your program should work 
(it will also show up in your VB references without having to browse for it)
Hope this helps
Shaun
Web/Application Developer
VB6 Ent (SP5), Win 2000,SQL Server 2000
-
Sep 26th, 2000, 05:32 AM
#3
Thread Starter
Addicted Member
Cheers, I'll give it a go
DOH !!
I was doing the following
regsvr32 my.dll
Forgetting the path....
You are a godsend...Thanks
Steve
-
Sep 26th, 2000, 06:14 AM
#4
Thread Starter
Addicted Member
Another issue.....
Okay,
Tried what has been suggested and got the following which means nothing to me......
The Following message appeared:
C:\Blah Blah Path Mydll.dll was loaded, but the Dllregisterserver may not be exported, or a corrupt version of C:\Blah Blah Path Mydll.dll may be in memory. Consider using Pview to detect and remove it
Two questions really,
1. What does this mean and how do I fix it ?
2. What is Pview ?
Cheers for any help
Steve
-
Sep 26th, 2000, 06:26 AM
#5
Addicted Member
Hi,
Nasty error! Basically, what it means(more than likely) is that the dll is not a COM dll. ie. You cannot reference it in the normal way because it does not expose anything.
What you will have to do is to Declare it in your code much the same as you would for an API call.
Without the dll, I can't really help any more.
(send it if you want )
Cheers
Shaun
Web/Application Developer
VB6 Ent (SP5), Win 2000,SQL Server 2000
-
Sep 26th, 2000, 06:30 AM
#6
Thread Starter
Addicted Member
This is one of Microsofts though, Not mine !!!
The Dll I am trying to register is one of the "biggies" though (At least I think it is)
Its this one
C:\Program Files\Common Files\Microsoft Shared\VBA\Vba332.dll
Which I would assume would be COM
Steve
-
Sep 26th, 2000, 06:51 AM
#7
Addicted Member
Hi,
That particular dll is not COM. Unless you know what functions are in it (I don't btw) you have no way of using it.
Are you sure this is the dll you are after?
Sorry I can't help more
Shaun
Web/Application Developer
VB6 Ent (SP5), Win 2000,SQL Server 2000
-
Sep 26th, 2000, 07:02 AM
#8
Thread Starter
Addicted Member
My error is here....
When I debug, my error comes up on the line setting sString below.....
Code:
Public Function BrowseForFolder(ByVal lHwnd As Long, ByVal sPrompt As String) As String
Dim tBI As BROWSEINFO
Dim lList As Long
Dim lResult As Long
Dim sPath As String
Dim sString As String
sString = Space(260)
With tBI
.hwndOwner = lHwnd
.lpszTitle = lStrCat(sPrompt, Chr(0))
.pszDisplayName = StrPtr(sString)
.ulFlags = BIF_RETURNONLYFSDIRS
End With
When I look in the object browser for Space, it leads back to that dll so I just assumed that was the dll the wasn't doing what it should have.....
Cheers and again thanks for all your help
Steve
-
Sep 26th, 2000, 07:11 AM
#9
Addicted Member
Hi again.
If you want the BrowseForFolder code then use this:
Code:
'Stick in a .bas module
Private Const BIF_RETURNONLYFSDIRS = 1
Private Const BIF_DONTGOBELOWDOMAIN = 2
Private Const MAX_PATH = 260
Private Declare Function SHBrowseForFolder Lib _
"shell32" (lpbi As BrowseInfo) As Long
Private Declare Function SHGetPathFromIDList Lib _
"shell32" (ByVal pidList As Long, ByVal lpBuffer _
As String) As Long
Private Declare Function lstrcat Lib "kernel32" _
Alias "lstrcatA" (ByVal lpString1 As String, ByVal _
lpString2 As String) As Long
Private Type BrowseInfo
hWndOwner As Long
pIDLRoot As Long
pszDisplayName As Long
lpszTitle As Long
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type
Public Function BrowseForFolder(CallingForm As Form, gfTitle As String) As String
'Opens a Browse Folders Dialog Box that displays the
'directories in your computer
Dim lpIDList As Long
Dim sBuffer As String
Dim szTitle As String
Dim tBrowseInfo As BrowseInfo
szTitle = gfTitle
'Text to appear in the the gray area under the title bar
'telling you what to do
With tBrowseInfo
.hWndOwner = CallingForm.hWnd 'Owner Form
.lpszTitle = lstrcat(szTitle, "")
.ulFlags = BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN
End With
lpIDList = SHBrowseForFolder(tBrowseInfo)
If (lpIDList) Then
sBuffer = Space(MAX_PATH)
SHGetPathFromIDList lpIDList, sBuffer
sBuffer = Left(sBuffer, InStr(sBuffer, vbNullChar) - 1)
End If
BrowserForFolder = sBuffer
End Function
and then call it from your form like this:
Code:
dim strFolder as string
strFolder = BrowseForFolder(Me,"Choose A Folder")
I've not had any errors with this so maybe it will help
Shaun
Web/Application Developer
VB6 Ent (SP5), Win 2000,SQL Server 2000
-
Sep 26th, 2000, 07:17 AM
#10
Thread Starter
Addicted Member
Thats what I am using
Yeah, thats what I am using but for some reason on two machines that I have loaded this spreadsheet it works fine. On the other I get all the problems that I have mentioned......
I have no idea why..... (I also get problems with Left and right, maybe its string commands that are the problem)
Steve
-
Sep 26th, 2000, 07:21 AM
#11
Addicted Member
In that case then...
Have you considered reinstalling VB (maybe the offending dll's are corrupted).
Shaun
Web/Application Developer
VB6 Ent (SP5), Win 2000,SQL Server 2000
-
Sep 26th, 2000, 07:26 AM
#12
Thread Starter
Addicted Member
Thanks for the advice
One last comment
VB is not installed, I am using VBA, maybe thats the problem.... (I just assumed if you registered the dll's you could use its functions)
Never mind, that person won't be able to use my application......
Regards,
Steve
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
|