ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Commandbutton enable/disabling (https://www.excelbanter.com/excel-programming/328679-commandbutton-enable-disabling.html)

Pat

Commandbutton enable/disabling
 
Private Sub PLabels_Click()
Sheets("PrintLabels").Select
ActiveSheet.Calculate

'event procedure
CloseExcelHLS

' command button
PrintLabels.Export.Enabled = True

'command button
PrintLabels.CloseExcelExport.Enabled = False
End Sub


The above is triggered from another sheet called PList. CloseExcelHLS is an
event and once it completes running the code stops at:

PrintLabels.Export.Enabled = True

Anyone got a solution for this?
Thank you if you can be of help.

Pat






Jim Thomlinson[_3_]

Commandbutton enable/disabling
 
It is hard to tell from the code you have posted. My only suggestion is that
if you have cmd buttons that you are trying to manipulate and it won't work
try being more explicit in your declarations. Reference the sheet or form
that the button is on prior to referencing the button... Something like

Sheet1.CommandButton1.enabled = false

HTH

"Pat" wrote:

Private Sub PLabels_Click()
Sheets("PrintLabels").Select
ActiveSheet.Calculate

'event procedure
CloseExcelHLS

' command button
PrintLabels.Export.Enabled = True

'command button
PrintLabels.CloseExcelExport.Enabled = False
End Sub


The above is triggered from another sheet called PList. CloseExcelHLS is an
event and once it completes running the code stops at:

PrintLabels.Export.Enabled = True

Anyone got a solution for this?
Thank you if you can be of help.

Pat







Pat

Commandbutton enable/disabling
 
Hi Jim,
That's exactly what I am currently doing.

PrintLabels.Export.Enabled = True

PrintLabels = sheet name
Export = commandbutton name



"Jim Thomlinson" wrote in message
...
It is hard to tell from the code you have posted. My only suggestion is
that
if you have cmd buttons that you are trying to manipulate and it won't
work
try being more explicit in your declarations. Reference the sheet or form
that the button is on prior to referencing the button... Something like

Sheet1.CommandButton1.enabled = false

HTH

"Pat" wrote:

Private Sub PLabels_Click()
Sheets("PrintLabels").Select
ActiveSheet.Calculate

'event procedure
CloseExcelHLS

' command button
PrintLabels.Export.Enabled = True

'command button
PrintLabels.CloseExcelExport.Enabled = False
End Sub


The above is triggered from another sheet called PList. CloseExcelHLS is
an
event and once it completes running the code stops at:

PrintLabels.Export.Enabled = True

Anyone got a solution for this?
Thank you if you can be of help.

Pat









Bob Phillips[_6_]

Commandbutton enable/disabling
 
Maybe

Worksheets("PrintLabels").Export.Enabled = True

'command button
Worksheets("PrintLabels").CloseExcelExport.Enabled = False

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Pat" wrote in message
...
Private Sub PLabels_Click()
Sheets("PrintLabels").Select
ActiveSheet.Calculate

'event procedure
CloseExcelHLS

' command button
PrintLabels.Export.Enabled = True

'command button
PrintLabels.CloseExcelExport.Enabled = False
End Sub


The above is triggered from another sheet called PList. CloseExcelHLS is

an
event and once it completes running the code stops at:

PrintLabels.Export.Enabled = True

Anyone got a solution for this?
Thank you if you can be of help.

Pat








Jim Thomlinson[_3_]

Commandbutton enable/disabling
 
Sorry. You have not premised your objects with the standard 3 letter
abbreviations like sht, wks or cmd so it was a little hard to tell. What is
your event code? Perhaps you need to resolve the declarations to

VBAProject.PrintLabels.Export.Enabled = True

I might be worried about the object names PrintLabels or Export being
reserved words. Try changing them to

shtPrintLabels and cmdExport to resolve any potential conflicts there...

HTH

"Pat" wrote:

Hi Jim,
That's exactly what I am currently doing.

PrintLabels.Export.Enabled = True

PrintLabels = sheet name
Export = commandbutton name



"Jim Thomlinson" wrote in message
...
It is hard to tell from the code you have posted. My only suggestion is
that
if you have cmd buttons that you are trying to manipulate and it won't
work
try being more explicit in your declarations. Reference the sheet or form
that the button is on prior to referencing the button... Something like

Sheet1.CommandButton1.enabled = false

HTH

"Pat" wrote:

Private Sub PLabels_Click()
Sheets("PrintLabels").Select
ActiveSheet.Calculate

'event procedure
CloseExcelHLS

' command button
PrintLabels.Export.Enabled = True

'command button
PrintLabels.CloseExcelExport.Enabled = False
End Sub


The above is triggered from another sheet called PList. CloseExcelHLS is
an
event and once it completes running the code stops at:

PrintLabels.Export.Enabled = True

Anyone got a solution for this?
Thank you if you can be of help.

Pat










Jim Thomlinson[_3_]

Commandbutton enable/disabling
 
Yup. Looks like export is a reserved word... I typed export into my VBE code
window as a stand alone line and it capitalized itself when I left the line.
Usually that is a good indications that the word is reserved and should not
be used...

HTH

"Jim Thomlinson" wrote:

Sorry. You have not premised your objects with the standard 3 letter
abbreviations like sht, wks or cmd so it was a little hard to tell. What is
your event code? Perhaps you need to resolve the declarations to

VBAProject.PrintLabels.Export.Enabled = True

I might be worried about the object names PrintLabels or Export being
reserved words. Try changing them to

shtPrintLabels and cmdExport to resolve any potential conflicts there...

HTH

"Pat" wrote:

Hi Jim,
That's exactly what I am currently doing.

PrintLabels.Export.Enabled = True

PrintLabels = sheet name
Export = commandbutton name



"Jim Thomlinson" wrote in message
...
It is hard to tell from the code you have posted. My only suggestion is
that
if you have cmd buttons that you are trying to manipulate and it won't
work
try being more explicit in your declarations. Reference the sheet or form
that the button is on prior to referencing the button... Something like

Sheet1.CommandButton1.enabled = false

HTH

"Pat" wrote:

Private Sub PLabels_Click()
Sheets("PrintLabels").Select
ActiveSheet.Calculate

'event procedure
CloseExcelHLS

' command button
PrintLabels.Export.Enabled = True

'command button
PrintLabels.CloseExcelExport.Enabled = False
End Sub


The above is triggered from another sheet called PList. CloseExcelHLS is
an
event and once it completes running the code stops at:

PrintLabels.Export.Enabled = True

Anyone got a solution for this?
Thank you if you can be of help.

Pat










Pat

Commandbutton enable/disabling
 
That worked great.

Many thanks gentlemen for your help.
Pat

"Bob Phillips" wrote in message
...
Maybe

Worksheets("PrintLabels").Export.Enabled = True

'command button
Worksheets("PrintLabels").CloseExcelExport.Enabled = False

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Pat" wrote in message
...
Private Sub PLabels_Click()
Sheets("PrintLabels").Select
ActiveSheet.Calculate

'event procedure
CloseExcelHLS

' command button
PrintLabels.Export.Enabled = True

'command button
PrintLabels.CloseExcelExport.Enabled = False
End Sub


The above is triggered from another sheet called PList. CloseExcelHLS is

an
event and once it completes running the code stops at:

PrintLabels.Export.Enabled = True

Anyone got a solution for this?
Thank you if you can be of help.

Pat











All times are GMT +1. The time now is 05:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com