cant find vba5.dll, execute code from a variable

smiler44

Registered User.
Local time
Today, 21:27
Joined
Jul 15, 2008
Messages
671
I am trying to execute a line of code using a variable. for example
picture1.visible = true picture1 being a variable. the code below is not mine but copied from another forum of sample codes but it more clearly shows the type of
code I'm using. this works in design time but if I make an executable file and run the executable from the same pc and directory I get an error message 53 can not find vba5.dll.
Do I need to do something with vba5.dll which is on my pc?


Use the EbExecuteLine API function in vba6.dll, vba5.dll, or vba332.dll.

Function FExecuteCode(stCode As String, Optional fCheckOnly _ As Boolean) As Boolean FExecuteCode = EbExecuteLine(StrPtr(stCode), 0&, 0&, _ Abs(fCheckOnly)) = 0End FunctionPrivate Sub Command1_Click() Dim res As Boolean res = FExecuteCode(Text1.Text) Label1.Caption = "Status = " & resEnd Sub I have an existing project with code below which works ok but dont understand itPrivate Declare Function EbExecuteLine Lib "vba5.dll" _
(ByVal pStringToExec As Long, ByVal Foo1 As Long, _
ByVal Foo2 As Long, ByVal fCheckOnly As Long) As Long
Function FExecuteCode(stCode As String, Optional fCheckOnly As Boolean) As Boolean
Dim retval As Long If boolCheckFileAccess("c:\Exchanges\" & filename & ".txt", "Read") Then
retval = Shell(note_pad_route & " " & "c:\Exchanges\" & filename & ".txt", 1)
Else
Call MsgBox("File - " & filename & " does not exist", vbOKOnly, "Missing File")
End If

End Function any help will be appreciatedthanks:rolleyes:
 
Firstly, please put your code in [code]Your Code Here[/code] to make it look like this:
Code:
Your Code Here
and thus preserve the formatting. I can hardly follow your code sample.

Secondly, you really don't need to use a Declare function- you can just go to Tools -> References then click Browse to get that vbaXXX.dll (specific number depends on your version), which I am sure is already installed. It also means you gets to use early binding, which makes your coding easier and less bug-prone.

But I'm also pretty sure it IS already checked by default, under name "Visual Basic for Application. Check the references to be sure.

Thirdly, if you can't find that file, you may have to repair your office installation.

Finally, I'm afraid I am at loss at what you are trying to do. You talk about picture but this look like it is supposed to shell out to an external application... elaborate, please?
 
I'm also confused by the statement

"this works in design time but if I make an executable file and run the executable from the same pc and directory I get an error message"

There are no executable files in MS Access!
 
opps sorry. I can now see I have posed to an Access forum instead of a visual basic forum.

I'm very sorry to have wasted peoples time. Will try to find correct forum, thanks you
 
Does EbExecuteLine even work in any compiled application?
It's my understanding that it doesn't.
 
I am only an dabbler with VB but I'm sure that another program I have works ok. I wrote most of it but not the bit that executes the string and I can not understand the code. I cant even recall where it came from.:)
 

Users who are viewing this thread

Back
Top Bottom