Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refer Dll's 1

Status
Not open for further replies.

CharlesFS

Technical User
Dec 14, 2008
39
BR
Hi, i have in my access2007 project one vb module with reference to msxml4.dll(Microsoft xml, v4.0) and scrrun.dll(Microsoft Scripting Rintime).

I need a way to make my project run in others pc's without these dll's pre installed. But a way without user interention.
Sorry for my english.


Thanks
Charles F.S.
 
Don't reference the DLLs and use late binding.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
For the most part, late binding will solve problems with references in VBA, unless you have some unusual references. Most problems are caused by differences in library versions that can be overcome with late binding. With VBA, it is often recommended that you develop with early binding but release with late binding. The main disadvantage of late binding is changing built-in constants to values (speed is no longer the issue it used to be.)

So:

Code:
Dim fs As Object 'Instead of FileSystemObject '

Set fs=CreateObject("Scripting.FileSystemObject")

'Value instead of built-in constant '
ForReading=2
Set f = fs.OpenTextFile("c:\testfile.txt", ForReading)

If this is not going to suit, you will probably need an installer.



 
Thanks for the post but i dont' understant how your code work.
This is one function of my code:

Option Explicit

Function HTTPSessionRequest(method, url, data)

Dim poStvars
Dim Xmlhttp
Dim Strheaders
Dim Sreturn
Dim Nlenhead
Dim Istart
Dim I, J
Dim Nfoundat
Dim Sref
'init
'Set Xmlhttp = CreateObject("MICROSOFT.XMLHTTP")
Set Xmlhttp = CreateObject("Msxml2.ServerXMLHTTP")
poStvars = Trim(data)

'connect

Xmlhttp.SetOption 2, 13056
Xmlhttp.Open method, Trim(url), False

With Xmlhttp

'set hdrs
If UCase(method) = "POST" Then
.setRequestHeader "Content-Type", _
"application/x-End If
.setRequestHeader "User-Agent", _
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"

'add the old referrer
.setRequestHeader "ACCEPT-LANGUAGE", "en-us"
.setRequestHeader "Accept", _
"image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, " & _
"application/vnd.ms-excel, application/msword, */*"

'add a dummy cookie
.setRequestHeader "cookie", "dummy=dummy"

'send data
.send poStvars

'.waitForResponse 1000

'wait for response you might
'While .readyState <> 4
'.waitForResponse 1000
'Wend

'get headers
Strheaders = .getAllResponseHeaders()

Sreturn = .responseText
End With

'done with http
Set Xmlhttp = Nothing

HTTPSessionRequest = Sreturn

End Function


This have soluction?
 
You already use late binding, so the code should compile and work even if you remove the reference.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV, exactly, worked without reference.

Now...have a possibility to make my .accdb portable?
Put the dll files and the .accdb file into a pen drive, and execute de .accdb file in any machine.

I thinks the problem is make vba register the dll files inside th pen drive to "CreateObject("Msxml2.ServerXMLHTTP")" work.

What you think PHV?
 
Yes, you need to install those DLL files if they are not present, which includes registering them. Of course, you need to find out if you are allowed to distribute those files (if they are Microsoft, you probably can).

You should create some sort of install package. You shouldn't try to do this transparently in the background - the user has a right to know that you are installing something on their machine.

Joe Schwarz
Custom Software Developer
 
It is not always a good idea to install dlls, there are copyright problems with some, and in other cases it may not be necessary, the various versions of office libraries, for example.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top