[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Run time error '424'

Posted on 2009-04-02
6
Medium Priority
?
420 Views
Last Modified: 2012-05-06
I am getting run time error after trying to paste picture on commandbutton surface


Private Sub CommandButton1_Click()
 
MsgBox "You selected " & GetImportFileName
CommandButton1.Picture = GetImportFileName    '<--RUN TIME ERROR '424' 
End Sub
 
Function GetImportFileName() As Variant
    Dim Filt As String
    Dim FilterIndex As Integer
    Dim FileName As Variant
    Dim Title As String
    
'   Set up list of file filters
    Filt = "Text Files (*.txt),*.txt," & _
           "Lotus Files (*.prn),*.prn," & _
           "Comma Separated Files (*.csv),*.csv," & _
           "ASCII Files (*.asc),*.asc," & _
           "All Files (*.*),*.*"
 
'   Display *.* by default
    FilterIndex = 5
 
'   Set the dialog box caption
    Title = "Select a File to Import"
 
'   Get the file name
    FileName = Application.GetOpenFilename _
        (FileFilter:=Filt, _
         FilterIndex:=FilterIndex, _
         Title:=Title)
 
'   Exit if dialog box canceled
    If FileName = False Then
        MsgBox "No file was selected."
        Exit Function
    End If
   
'   Display full path and name of the file
    
    GetImportFileName = FileName
    
End Function

Open in new window

0
Comment
  • 4
6 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1500 total points
ID: 24047276
CommandButton1.Picture  does not accept a string with the filename, but needs to get assigned the picture object.
0
 

Author Comment

by:Ramanathan Tito Titan Nadar
ID: 24047840
Hi, May i know how to assign picture object. Thanks
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 24047862
And none of your file types are image files anyway! :)
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:Ramanathan Tito Titan Nadar
ID: 24056178
I am sorry,  could get the meaning. How to do that.
0
 

Author Comment

by:Ramanathan Tito Titan Nadar
ID: 24056189
My objective is by click command button, I must able to select picture on paste on button surface.
0
 

Author Comment

by:Ramanathan Tito Titan Nadar
ID: 24056304
Thank you, i did manage to over come the problem. Cheers
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question