Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maury Markowitz formulated on Saturday :
On Apr 27, 3:33Â*pm, GS wrote: Â* If Not Environ("ComputerName") = <ServerName Then _ Â* Â* ThisWorkbook.Close SaveChanges:=False Looking over the thread€¦ The machine in question is a PC, a virtual "cloud server" to be exact. My current model is to place a template file on the server, and ask the user the open it there. As part of the scripts, it will created and save out a new file (a simple one, no scripts) that can then be opened on any Mac or PC. So I think the Environ method should work for this purpose. But the purpose of this call is to make sure they open it on the right machine. If they don't, they get a warning. But I *suspect* that if they were to open it on the Mac, the compiler would trip on the Enviorn call and put up some nasty user-unfriendly message. Any ideas on how to avoid this? You can use an error handler... Sub Whatever() '..Dim stuff On Error GoTo errhandler 'Macs will choke on this If Not Environ("ComputerName") = <computername Then _ ThisWorkbook.Close SaveChanges:=False '..Do stuff normalexit: Exit Sub errhandler: MsgBox "You can't use this template on this machine!" End Sub ...assumes the stored project runs on the machine accessing the project on the server. -- Garry Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Remote Machine not available | Excel Programming | |||
Strange formatting on one machine only | Excel Programming | |||
Reference & update destin. cells on 1st machine from source workbook on 2nd machine. | Excel Discussion (Misc queries) | |||
Password not working on one machine | Excel Discussion (Misc queries) | |||
Macro doesn't run on new machine | Excel Programming |