View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default code problem not working HELP

See if this site helps any:

http://puremis.net/excel/code/063.shtml



"BillD" wrote in message
...
I am still learning this code stuff so any and all help will be appreciated
with some detail on the code problem I am having. There are 2 problems:

1- I am trying to create a userform where only the form shows when I open
the application. The code I have below opens the application and then
opens
the form but the application is still visible, and I cannot get into the
application to make changes or view reports/charts. I don't know if I have
something out of order or missing please advise on the correct code:

In This Workbook I entered the following:

Private Sub Workbook_Open()
Load userform1
userform1.show
Application.visible=False

2. In order to get the workbook visible so I can make changes and view
charts I am going to put a command button on the userform, but I want the
button to be passworded. I want to click on the button and make the
application visible and allow for changes, viewing and printing
charts/reports.

What and where do I add code to view the workbook, and if possible to make
the workbook not visible after I am done with changes? Also I need to know
what to put in place of Sheets("sheet2").select so that the workbook opens
back up
Here is the code for the command button

Private Sub Commandbutton1_Click()
dim PWD as string
PWD = inputbox(prompt:="Enter Password")
if PWD = "xxxxxxxxx" then
Sheets("Sheet2").select
else
msgbox "incorrect password"
End if
End sub
--
BillD