Results 1 to 5 of 5

Thread: Opening XLSM file [SOLVED]

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    4

    Question Opening XLSM file [SOLVED]

    Hi all,

    I have a code where i need to open a other workbook. I works fine with .xls files, but when im trying to open a .xlsm file i just get a error? Anyone can see why?



    Code:
     
    Private Sub CommandButton1_Click()
    Dim i As Integer
    Dim pw            As String
    Dim path            As String
    Dim clor            As String
     
    Application.ScreenUpdating = False
    
    With ListBox1
    For i = 0 To .ListCount - 1
    If .ListIndex = i Then pw = Range("B" & i + 4).Value
    If .ListIndex = i Then path = Range("G" & i + 4).Value
    If .ListIndex = i Then clor = Range("I" & i + 4).Select
    Next i
    End With
     
    'ERROR COMES HERE!
        Application.Workbooks.Open Filename:=path
    Last edited by maxkoy; Nov 30th, 2009 at 02:39 PM.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Opening XLSM file

    What is the error?

    Are you using Excel 2007 (if you aren't, there is the problem)

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    4

    Re: Opening XLSM file

    Yes im using excel 2007, its error 1004 i get. And the debug mode marks this line

    "Application.Workbooks.Open Filename:=path"

  4. #4
    Fanatic Member dmaruca's Avatar
    Join Date
    May 2006
    Location
    Jacksonville, FL
    Posts
    577

    Re: Opening XLSM file [NOT SOLVED]

    The 1004 error in vba is pretty generic. What was the error description? Are your macro security settings set to low?

  5. #5

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    4

    Re: Opening XLSM file [SOLVED]

    Just changed some macro settings and it seems like it helped. Thanks to all you guys!

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width