View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Office User Office User is offline
external usenet poster
 
Posts: 18
Default change from DialogSheets to Userform

Trying to update an old Excel 95 template in Excel 2000 version. Part of the
code is dealing with DialogSheets which, I found out, were replaced by
userforms. When this ran in 95, the caption of the dialog box would change.
Essentially the same dialog box was used but the controls changed based on
the status.

Does anyone have a suggestion for changing this to userforms? Do I need to
create 2 different userforms and then somehow code it dependent on that?

Below is the code:


Sub LockSheet()
'Controls the Lock Sheet button on the Customize page
Const LockDlg = "Lock"
Const Lock_String = "Lock/Save Sheet"
Const Lock_Text = "You can lock the information on the Customize page
and save your customized version of the template."
Const Unlock_String = "Unlock This Sheet"
Const Unlock_Text = "By unlocking this sheet, you enable changes to be
made to the information on the Customize sheet. Select ""Lock This Sheet""
after you make your changes to protect the sheet from accidental changes."
Const Save_Alrt = "Your new customized template has been saved to the
default directory. "
Const Save_Alrt2 = "To begin using the invoice, double-click the
shortcut in Pioneer Applications folder."
Const Save_Filter = "Templates,*.xlt"
Const Save_Title = "Save Template"


If Sheets(Vital).DrawingObjects("Lock").Caption = Lock_String Then

If DialogSheets(LockDlg).Show Then
Sheets(Vital).Protect DrawingObjects:=True, Contents:=True
Sheets(Vital).DrawingObjects("Lock").Caption = Unlock_String
Sheets(LockDlg).DialogFrame.Caption = Unlock_String
Sheets(LockDlg).TextBoxes("PNL1_TXT1").Text = Unlock_Text
Sheets(LockDlg).GroupBoxes("PNL2").Visible = False
Sheets(LockDlg).OptionButtons("LCK_1").Visible = False
Sheets(LockDlg).OptionButtons("LCK_2").Visible = False
Sheets(LockDlg).TextBoxes("PNL1_TXT1").Height = 80
If Sheets(LockDlg).OptionButtons("LCK_2").Value = xlOn Then
ThisDir = CurDir()
TempDir = Application.TemplatesPath
ChDrive Mid(TempDir, 1, 1)
ChDir TempDir
FileNm = Application.GetSaveAsFilename(FileFilter:=Save_Fil ter,
Title:=Save_Title)
If FileNm < False Then
OWFlg = Application.DisplayAlerts
Application.DisplayAlerts = False
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets(Content1).Activate
Sheets(Vital).Visible = False
With ActiveWorkbook
.SaveAs Filename:=FileNm, FileFormat:=xlTemplate
FName = .FullName
PName = .Path
End With
Application.DisplayAlerts = OWFlg
MsgBox Save_Alrt & PName & Save_Alrt2, vbOKOnly + vbInformation,
SheetBar
ThisWorkbook.Close
End If
ChDrive Mid(ThisDir, 1, 1)
ChDir ThisDir
End If
End If

Else

If DialogSheets(LockDlg).Show Then
Sheets(Vital).Unprotect
Sheets(Vital).DrawingObjects("Lock").Caption = Lock_String
Sheets(LockDlg).DialogFrame.Caption = Lock_String
Sheets(LockDlg).TextBoxes("PNL1_TXT1").Text = Lock_Text
Sheets(LockDlg).GroupBoxes("PNL2").Visible = True
Sheets(LockDlg).OptionButtons("LCK_1").Visible = True
Sheets(LockDlg).OptionButtons("LCK_2").Visible = True
Sheets(LockDlg).TextBoxes("PNL1_TXT1").Height = 40
End If

End If

End Sub


Thanks for any input.
Marcia