586,069 active members*
3,667 visitors online*
Register for free
Login
IndustryArena Forum > CAD Software > Solidworks > How do you open excel workbook from within SW VBA?
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2009
    Posts
    10

    How do you open excel workbook from within SW VBA?

    I have a macro that opens a drawing file, activates the BOM, and then writes all the information to a text file. I then have a separate macro in excel that imports the text file for manipulation. How can you combine the steps into one?

    I have added the Microsoft Excel 12.0 Object Library reference, which allows normal excel commands such as "Range()" to be accepted. Right now I have the following:

    Workbooks.Open FileName:="\\Blgnas\engineering\PROCESS & DESIGN\TEMPLATES\SupplyChainExport.xlsm"

    The excel workbook does not visibly open, however, upon trying to open the workbook in excel it says it is already open. The code is successful when used within excel vba, but not SW vba.

    Anyone have any suggestions?

  2. #2
    Join Date
    May 2008
    Posts
    7
    B4 U open u have to create an object.

    Set MyExcelApp = CreateObject("Excel.Application")
    MyExcelApp.Visible = True
    MyExcelApp.Workbooks.Open FileName:="\\Blgnas\engineering\PROCESS & DESIGN\TEMPLATES\SupplyChainExport.xlsm"

Similar Threads

  1. Using Excel for Gcode
    By itsme in forum G-Code Programing
    Replies: 8
    Last Post: 03-22-2018, 03:28 PM
  2. EXCEL PMC10T24
    By CHANDRU in forum CNC Machining Centers
    Replies: 1
    Last Post: 05-11-2015, 07:28 PM
  3. Microsoft Excel HELP please
    By Dolphin USA in forum Computers / Desktops / Networking
    Replies: 2
    Last Post: 12-04-2007, 04:06 PM
  4. Excel Formula
    By honk in forum Community Club House
    Replies: 1
    Last Post: 06-09-2006, 06:14 PM
  5. Excel 810
    By Dale283 in forum Fanuc
    Replies: 0
    Last Post: 01-16-2006, 12:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •