View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jason V[_2_] Jason V[_2_] is offline
external usenet poster
 
Posts: 22
Default Accessing cells in Excel spreadsheet from Visio

Thanks Nick. This works. This code opens an existing excel workbook, I now
how to create a new one, bu how do you place access an excel workbook that is
already open. I have tried set xlwb = activeworkbook and set xlws =
activeworksheet but I still get an error.
--
Jason V


"NickHK" wrote:

Jason,
Assuming Visio works similar to other VBA enabled app:
-Set a reference the Excel type library.
Dim XLApp As Excel.Application
Dim XLWB As Excel.Workbook

Set XLApp=New Excel.Application
Set XLWB=XLApp.Workbook.Open("PathAndFileNameThatYouWa nt.xls")

Msgbox "The shape name is: " & XLWB.Worksheets(1).Range("A1").Value

Obviously change the worksheet and range to that required.

NickHK

"Jason V" wrote in message
...
I want to drop a shape on a visio drawing using vba in visio or excel. If

I
use the macro in Visio I want to get the name of the shape to drop from a
cell on a worksheet or from a variable name in an excel macro. Can anyone
help? Thanks.
--
Jason V