hibiscus27
04-19-2007, 12:27 PM
Hello
I have code attached to a button that opens up a dialog box where they can find a file and attach/embed to excel.
Essentially if they need to attach the file, the check the appropriate box. Then a button appears. This button will allow them to find the file and it attaches the file as an icon.
The problem is that some of us can do it...others can't. Here's what I mean. All of us can check the box and the button appears. But some when they click the button (which opens up the dialog box) they get sent to the VBA code instead.
How can I fix this??? Thanks!!!!
'***** On click the attach file button appears
Private Sub CheckBox1_Click()
If CheckBox1.Value = "True" Then
btnAddFile1.Visible = True
Else
btnAddFile1.Visible = False
End If
End Sub
'***** Inserts or embeds file into form
Private Sub btnAddFile1_Click()
Dim vFile As Variant
vFile = Application.GetOpenFilename("All Files(*.*),*.*", Title:="Find file to insert")
If vFile = False Then GoTo Cancel
ActiveSheet.OLEObjects.Add Filename:=vFile, Link:=False, DisplayAsIcon:=True, IconLabel:="test"
Exit Sub
'If X was equal to false, displays a message and exits the macro
Cancel:
MsgBox "The Cancel button was selected."
End Sub
I have code attached to a button that opens up a dialog box where they can find a file and attach/embed to excel.
Essentially if they need to attach the file, the check the appropriate box. Then a button appears. This button will allow them to find the file and it attaches the file as an icon.
The problem is that some of us can do it...others can't. Here's what I mean. All of us can check the box and the button appears. But some when they click the button (which opens up the dialog box) they get sent to the VBA code instead.
How can I fix this??? Thanks!!!!
'***** On click the attach file button appears
Private Sub CheckBox1_Click()
If CheckBox1.Value = "True" Then
btnAddFile1.Visible = True
Else
btnAddFile1.Visible = False
End If
End Sub
'***** Inserts or embeds file into form
Private Sub btnAddFile1_Click()
Dim vFile As Variant
vFile = Application.GetOpenFilename("All Files(*.*),*.*", Title:="Find file to insert")
If vFile = False Then GoTo Cancel
ActiveSheet.OLEObjects.Add Filename:=vFile, Link:=False, DisplayAsIcon:=True, IconLabel:="test"
Exit Sub
'If X was equal to false, displays a message and exits the macro
Cancel:
MsgBox "The Cancel button was selected."
End Sub