Opening an Excel Document from Access Form

  • Thread starter Thread starter Bright
  • Start date Start date
B

Bright

I have an access database with a switch board. i want to
place a command button on the form to open an excel
doucment. The excel document is in the application
directory.
 
-----Original Message-----
I have an access database with a switch board. i want to
place a command button on the form to open an excel
doucment. The excel document is in the application
directory.
.
Hi Bright, if you use the search feature for this forum
you will find similar postings and responses that may give
you other ideas....

try setting a reference to the excel object library using
tools|references in the vbe.

then use the following as an example...

dim xlApp as excel.application
dim xlBook as excel.workbook
dim strPath as string

' check if excel already open
on error resume next
set xlApp=getobject(,"excel.application")

if err.number<>0 then
' open a new session
set xlApp=new excel.application
end if

strpath=currentproject.path

with xlApp
set xlBook=xlApp.workbooks.open strPath & "file.xls"
end with

xlApp.visible=true

***** code end ******

for further help to code in excel use excel usergroup...

Luck
Jonathan
 
Back
Top