PC Review


Reply
Thread Tools Rate Thread

Confirmation of file

 
 
=?Utf-8?B?cGhpbA==?=
Guest
Posts: n/a
 
      21st Jan 2005
I want to write code in the Worksheet so that when users open the
spreadsheet [TMR.xls]it looks for and confirms that a file [hyperlink.twd]
exists in the Windows sys32 folder. Otherwise it closes the spreadsheet.
Does anyone know how to do this?
your help will be appreciated
here is the code
Private Sub Workbook_Open()
Worksheets.Select
Columns("A:M").Select
ActiveWindow.Zoom = True
ActiveSheet.ScrollArea = "A1:M30"
Range("A1").Select
Application.CommandBars.ActiveMenuBar.Enabled = False
Application.DisplayFullScreen = True
Application.CommandBars("Full Screen").Enabled = False
Dim NumberofTBs As Integer
Dim TBC As Integer
Let NumberofTBs = Toolbars.Count
For TBC = 1 To NumberofTBs
Toolbars(TBC).Visible = False
Next TBC
For TBC = 2 To 18
Application.CommandBars(TBC).Visible = False
Application.DisplayStatusBar = False
Application.DisplayFormulaBar = False
Next TBC
Application.Run "TMR.xls!Macro74"
Application.Run "TMR.xls!Macro76"

Sheets("MENU").Select

If ActiveWorkbook.FullName = "C:\TMR\TMR.xls" Then
Sheets("MENU").Select
Else
Sheets("End").Select
Range("A1").Select
MsgBox "Contact Psyfactor Ltd for Licence", vbOKOnly, "TMR"
Application.ActiveWorkbook.Save
Application.QUIT


End If

End Sub

Your help will be appreciated.

--
phil in da uk
 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmFjaw==?=
Guest
Posts: n/a
 
      21st Jan 2005
Phil,

Adding the following code will accomplish your task...

If Dir("C:\WINNT\system32\hyperlink.twd") = vbNullString Then
ThisWorkbook.Close False
End If

You may need to replace "WINNT" with "Windows" depending on if your running
NT or not.

The False after close prevents the save workbook dialog


"phil" wrote:

> I want to write code in the Worksheet so that when users open the
> spreadsheet [TMR.xls]it looks for and confirms that a file [hyperlink.twd]
> exists in the Windows sys32 folder. Otherwise it closes the spreadsheet.
> Does anyone know how to do this?
> your help will be appreciated
> here is the code
> Private Sub Workbook_Open()
> Worksheets.Select
> Columns("A:M").Select
> ActiveWindow.Zoom = True
> ActiveSheet.ScrollArea = "A1:M30"
> Range("A1").Select
> Application.CommandBars.ActiveMenuBar.Enabled = False
> Application.DisplayFullScreen = True
> Application.CommandBars("Full Screen").Enabled = False
> Dim NumberofTBs As Integer
> Dim TBC As Integer
> Let NumberofTBs = Toolbars.Count
> For TBC = 1 To NumberofTBs
> Toolbars(TBC).Visible = False
> Next TBC
> For TBC = 2 To 18
> Application.CommandBars(TBC).Visible = False
> Application.DisplayStatusBar = False
> Application.DisplayFormulaBar = False
> Next TBC
> Application.Run "TMR.xls!Macro74"
> Application.Run "TMR.xls!Macro76"
>
> Sheets("MENU").Select
>
> If ActiveWorkbook.FullName = "C:\TMR\TMR.xls" Then
> Sheets("MENU").Select
> Else
> Sheets("End").Select
> Range("A1").Select
> MsgBox "Contact Psyfactor Ltd for Licence", vbOKOnly, "TMR"
> Application.ActiveWorkbook.Save
> Application.QUIT
>
>
> End If
>
> End Sub
>
> Your help will be appreciated.
>
> --
> phil in da uk

 
Reply With Quote
 
=?Utf-8?B?cGhpbA==?=
Guest
Posts: n/a
 
      22nd Jan 2005
we'll give it a try..it looks right
and if it works I'll tick the box
thanks for your help

"Jack" wrote:

> Phil,
>
> Adding the following code will accomplish your task...
>
> If Dir("C:\WINNT\system32\hyperlink.twd") = vbNullString Then
> ThisWorkbook.Close False
> End If
>
> You may need to replace "WINNT" with "Windows" depending on if your running
> NT or not.
>
> The False after close prevents the save workbook dialog
>
>
> "phil" wrote:
>
> > I want to write code in the Worksheet so that when users open the
> > spreadsheet [TMR.xls]it looks for and confirms that a file [hyperlink.twd]
> > exists in the Windows sys32 folder. Otherwise it closes the spreadsheet.
> > Does anyone know how to do this?
> > your help will be appreciated
> > here is the code
> > Private Sub Workbook_Open()
> > Worksheets.Select
> > Columns("A:M").Select
> > ActiveWindow.Zoom = True
> > ActiveSheet.ScrollArea = "A1:M30"
> > Range("A1").Select
> > Application.CommandBars.ActiveMenuBar.Enabled = False
> > Application.DisplayFullScreen = True
> > Application.CommandBars("Full Screen").Enabled = False
> > Dim NumberofTBs As Integer
> > Dim TBC As Integer
> > Let NumberofTBs = Toolbars.Count
> > For TBC = 1 To NumberofTBs
> > Toolbars(TBC).Visible = False
> > Next TBC
> > For TBC = 2 To 18
> > Application.CommandBars(TBC).Visible = False
> > Application.DisplayStatusBar = False
> > Application.DisplayFormulaBar = False
> > Next TBC
> > Application.Run "TMR.xls!Macro74"
> > Application.Run "TMR.xls!Macro76"
> >
> > Sheets("MENU").Select
> >
> > If ActiveWorkbook.FullName = "C:\TMR\TMR.xls" Then
> > Sheets("MENU").Select
> > Else
> > Sheets("End").Select
> > Range("A1").Select
> > MsgBox "Contact Psyfactor Ltd for Licence", vbOKOnly, "TMR"
> > Application.ActiveWorkbook.Save
> > Application.QUIT
> >
> >
> > End If
> >
> > End Sub
> >
> > Your help will be appreciated.
> >
> > --
> > phil in da uk

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to execute a .cmd file on confirmation Developer Microsoft Dot NET Compact Framework 3 29th Apr 2007 05:34 PM
File Delete Confirmation Sue in Florida Windows XP Basics 1 18th Jun 2004 03:37 AM
File Confirmation Settings =?Utf-8?B?TWluaUNvb3Blcg==?= Windows XP Customization 2 10th May 2004 11:00 AM
Form confirmation file =?Utf-8?B?V2Vz?= Microsoft Frontpage 2 9th Jan 2004 11:33 AM
confirmation of registration of a .dot file user77 Microsoft Word Document Management 1 7th Oct 2003 02:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:59 AM.