+ Reply to Thread
Results 1 to 5 of 5

Reference to xlCellTypeConstants

  1. #1
    Registered User
    Join Date
    10-14-2008
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    35

    Reference to xlCellTypeConstants

    I found the following code in one of the posts on this forum:

    Sub Button1_Click()
    Dim Rng As Range
    Dim Arr As Variant
    Dim i As Long

    Arr = Array(xlCellTypeConstants)

    For i = 0 To UBound(Arr)
    Set Rng = Range(Cells(3, 2), Cells(Rows.Count, 2).End(xlUp)).SpecialCells(Arr(i), 23)
    On Error GoTo 0
    With Rng
    .Borders(xlInsideHorizontal).Weight = xlThin
    .Borders(xlInsideVertical).Weight = xlThin
    .BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
    End With
    'clear the variable
    Set Rng = Nothing
    Next i
    End Sub
    When i run it in Excel it works just fine but when i run it from solidworks then it says that xlCellTypeConstants variable not defined. Is xlCellTypeConstants something you can add in, in the references ?
    Thanks for any help.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I wouldn't think you can use an Excel macro from another program
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    10-14-2008
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    35
    Solidworks uses vba just like excel I often use excel code in solidworks so that part should work.

  4. #4
    Registered User
    Join Date
    10-14-2008
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    35
    I found what was wrong. In order for xlCellTypeConstants to work you have to have Excel 12.0 added in, in the references and I had Excel 5.0. Now it works great.

  5. #5
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284
    Quote Originally Posted by bguenther View Post
    I found what was wrong. In order for xlCellTypeConstants to work you have to have Excel 12.0 added in, in the references and I had Excel 5.0. Now it works great.
    Or just add your own constant

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1