Commandbutton enable/disabling

  • Thread starter Thread starter Pat
  • Start date Start date
P

Pat

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
 
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
 
Hi Jim,
That's exactly what I am currently doing.

PrintLabels.Export.Enabled = True

PrintLabels = sheet name
Export = commandbutton name
 
Maybe

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

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

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top