Click here to Skip to main content
15,904,652 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionProblem in accessing CD Drive in VB/VB.Net 2.0! Pin
priyamtheone29-Jul-08 6:06
priyamtheone29-Jul-08 6:06 
AnswerRe: Problem in accessing CD Drive in VB/VB.Net 2.0! Pin
Christian Graus29-Jul-08 20:11
protectorChristian Graus29-Jul-08 20:11 
GeneralRe: Problem in accessing CD Drive in VB/VB.Net 2.0! Pin
priyamtheone1-Aug-08 6:49
priyamtheone1-Aug-08 6:49 
QuestionWinsock array Pin
lorenzoo29-Jul-08 5:37
lorenzoo29-Jul-08 5:37 
AnswerRe: Winsock array Pin
jzonthemtn29-Jul-08 6:32
jzonthemtn29-Jul-08 6:32 
AnswerRe: Winsock array Pin
Ravi Kumar Tyagi29-Jul-08 21:30
Ravi Kumar Tyagi29-Jul-08 21:30 
Questionpassing data between procedures Pin
Matthew Leggett29-Jul-08 4:07
Matthew Leggett29-Jul-08 4:07 
AnswerRe: passing data between procedures Pin
ChandraRam30-Jul-08 23:19
ChandraRam30-Jul-08 23:19 
Hi
The issue with specifying the parameter when you create the button is that the value for the parameter will be fixed.
For instance:
Public Sub CreateButton()
  With ActiveWorkbook.Sheets("sheet1").Buttons.Add(600, 20, 100, 25)
    .OnAction = "'Procedure1 ""Hello"", " & nCount & "'"
    .Caption = "Bills Not Paid July"
    .Name = "JULY"
  End With
End Sub

Public Sub Procedure1(ByVal s As String, ByVal x As Integer)
  MsgBox s & " " & x
End Sub


In the code above, even though the parameter is specified as a variable, the value when you _define_ the OnAction is what will be passed in.

To get around this, you could try this:

Public Sub CreateButton()
  With ActiveWorkbook.Sheets("sheet1").Buttons.Add(600, 20, 100, 25)
    .OnAction = "July_Click"
    .Caption = "Bills Not Paid July"
    .Name = "JULY"
  End With
End Sub

Public Sub July_Click()
  Call ActiveWorkbook.Application.Run("Procedure1", "test", nCount)
End Sub

Public Sub Procedure1(ByVal s As String, ByVal x As Integer)
  MsgBox s & " " & x
End Sub


HTH
QuestionDatagrid Pin
g.hanuman29-Jul-08 3:29
g.hanuman29-Jul-08 3:29 
AnswerRe: Datagrid Pin
John_Adams29-Jul-08 4:21
John_Adams29-Jul-08 4:21 
QuestionPlease Clear my Confusion.. Pin
guriqbal8729-Jul-08 3:09
guriqbal8729-Jul-08 3:09 
AnswerRe: Please Clear my Confusion.. Pin
jzonthemtn29-Jul-08 3:36
jzonthemtn29-Jul-08 3:36 
AnswerRe: Please Clear my Confusion.. Pin
Mycroft Holmes29-Jul-08 19:11
professionalMycroft Holmes29-Jul-08 19:11 
GeneralRe: Please Clear my Confusion.. Pin
jzonthemtn30-Jul-08 4:29
jzonthemtn30-Jul-08 4:29 
AnswerRe: Please Clear my Confusion.. Pin
Vimalsoft(Pty) Ltd29-Jul-08 23:07
professionalVimalsoft(Pty) Ltd29-Jul-08 23:07 
QuestionHow I can Change the Regional and Language setting from my VB Application. Pin
Member 439237329-Jul-08 2:57
Member 439237329-Jul-08 2:57 
AnswerRe: How I can Change the Regional and Language setting from my VB Application. Pin
Luc Pattyn29-Jul-08 3:38
sitebuilderLuc Pattyn29-Jul-08 3:38 
AnswerRe: How I can Change the Regional and Language setting from my VB Application. Pin
jzonthemtn29-Jul-08 3:39
jzonthemtn29-Jul-08 3:39 
Questioncursorpos not working in visual studio express 2008 Pin
mahadevan290529-Jul-08 2:41
mahadevan290529-Jul-08 2:41 
AnswerRe: cursorpos not working in visual studio express 2008 Pin
Luc Pattyn29-Jul-08 3:45
sitebuilderLuc Pattyn29-Jul-08 3:45 
QuestionRe: cursorpos not working in visual studio express 2008 Pin
mahadevan290529-Jul-08 4:30
mahadevan290529-Jul-08 4:30 
QuestionCard Reader in Vb.net Pin
rajeshmohan29-Jul-08 2:36
rajeshmohan29-Jul-08 2:36 
AnswerRe: Card Reader in Vb.net Pin
jzonthemtn29-Jul-08 4:28
jzonthemtn29-Jul-08 4:28 
GeneralRe: Card Reader in Vb.net Pin
rajeshmohan30-Jul-08 0:04
rajeshmohan30-Jul-08 0:04 
Questionload menu dyanamically Pin
Ebube29-Jul-08 2:26
Ebube29-Jul-08 2:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.