Reference needed?

J

John Keith

I am trying to set up a VBA module that will work for both access and excel.
I was able to find Application properties to get the file and path, the
access code when seen by excel behaves (because of the Office11 reference)
but access will not recognize the ...activeworkbook... object even with the
either the Office11 or Excel11 reference.

Is there a reference that will allow access to allow this kind of coding?

On Error Resume Next
Dim path As String
Dim fileName As String
If Application.Name = "Microsoft Excel" Then
path = Application.ActiveWorkbook.path
fileName = Application.ActiveWorkbook.Name
ElseIf Application.Name = "Microsoft Access" Then
path = Application.CurrentProject.path
fileName = Application.CurrentProject.Name
Else
MsgBox Application.Name & " not currently supported", vbCritical,
"Automated File Transfer Module"
bShellFTP = False
Exit Function
End If
On Error GoTo 0
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top