button

  • Thread starter CommandButton_Click()
  • Start date
C

CommandButton_Click()

I have a buttom on a visio page that i want to open a .xls file and i have
the following code:


Private Sub CommandButton1_Click()
Dim a As String

a = "c:\****\****.xls" (location fo the file)

(her, is suposed enter a line code that open the file. help me plese.)

End Sub


Thank You
 
A

Al Edlund

of course since this is an excel file you have created an excel.application
object to capture the data you are trying to look at (since visio doesn't
know a thing about excel).
al
 
C

CommandButton_Click()

I tried the following code but I get an error "object doesn't support this
property or method". Help me. Thanks.

Private Sub CommandButton1_Click()
Dim objExcel as Object
set objExcel=CreateObject("Excel.Application")
Dim filename As String

filename = "c:\****\****.xls" <-- location of the file
objExcel.Visible=true
objExcel.workbook.Open filename

End Sub


"Al Edlund" escreveu:
 
A

Andy

You should have the following line, as the open method is on workbooks
not workbook:

objExcel.workbooks.Open filename
 

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