Dear Divia .... ... Again! :))))
Private Sub Workbook_Open()
Dim Opn1sttime As Integer, r As Long
On Error GoTo er 'for 1st time if we never savesetting, to handle
error!
r = GetSetting("AppName", "SectName", "KeyName") + 1
er:
if r = 0 then r = 1 'Assign open first time as 1 (first)SaveSetting
"AppName", "SectName", "KeyName", r
Opn1sttime = r
if Opn1sttime 1 then
ThisWorkbook.Close True
Else: UserForm!.Show
Endif
'MsgBox Opn1sttime ' Opn1sttime = Y , you mean Divia !
End Sub
'that saved in MS registry :
'HKEY_CURRENT_USER\Software\
VB and VBA Program Settings
Regards,,
Halim Chan :)
divya menuliskan:
I thought there is no command called workbook.save,Actually there is
,Activeworkbook.save works.My problem is sorted
Thnks for ure suggestion Nick
Is there a method by which we can programatically save the workbook?
Like workbook.close closes the workbook,I couldn't find
workbook.save.Is there a way to do.
Actually therz a variable suppose y, if its 1 then next time the user
opens the workbook therz a form which should'nt be displayed.So what I
1.therz a way to force the workbook to save immediately after taking
the input value for y,programatically.
2.A way to find that workbook is opened for the first time.