Greetings all,
Hopefully someone can help me with a small problem I've been having. I've got a workbook that has a template sheet in it. When activated the workbook pulls data from a database, then copies the template sheet and places the data into the copied template sheet and formats it. The new sheet that is created is renamed based upon the data pulled from the database. For example the template sheet is copied, the data is entered and formatted, then the sheet would be renamed 5R04.
Now the problem that I'm having is a button that's on the template sheet. For testing purposes the only thing the button does now is to pop up a message box. Now when the new sheet is created, I renamed the button as well. Also based up on the data pulled from the database. So in this example the button would be renamed CommandButton5R04 (the original button name is just CommandButton1).
Now the problem that i'm having is to actually get the command button to DO anything. Initially I wanted it to call a function that would modify the data on the new sheet (once again based upon the data pulled from the db). However it seems to just ignore the call. I've even tried creating a function named 5R04_Click(), and it ignores that as well. Okay, it's early and my brain isn't functioning at full capacity. But what am I missing here? Any help would be appreciated. Below are some of the code snippets relevant to the problem:
Dim cmdButton As OLEObject
Set cmdButton = ActiveSheet.OLEObjects("commandbutton1")
With cmdButton
.Name = "5R04"
End With
Private Sub 5R04_Click()
MsgBox ("Succesful Test")
End Sub
Hopefully someone can help me with a small problem I've been having. I've got a workbook that has a template sheet in it. When activated the workbook pulls data from a database, then copies the template sheet and places the data into the copied template sheet and formats it. The new sheet that is created is renamed based upon the data pulled from the database. For example the template sheet is copied, the data is entered and formatted, then the sheet would be renamed 5R04.
Now the problem that I'm having is a button that's on the template sheet. For testing purposes the only thing the button does now is to pop up a message box. Now when the new sheet is created, I renamed the button as well. Also based up on the data pulled from the database. So in this example the button would be renamed CommandButton5R04 (the original button name is just CommandButton1).
Now the problem that i'm having is to actually get the command button to DO anything. Initially I wanted it to call a function that would modify the data on the new sheet (once again based upon the data pulled from the db). However it seems to just ignore the call. I've even tried creating a function named 5R04_Click(), and it ignores that as well. Okay, it's early and my brain isn't functioning at full capacity. But what am I missing here? Any help would be appreciated. Below are some of the code snippets relevant to the problem:
Dim cmdButton As OLEObject
Set cmdButton = ActiveSheet.OLEObjects("commandbutton1")
With cmdButton
.Name = "5R04"
End With
Private Sub 5R04_Click()
MsgBox ("Succesful Test")
End Sub