ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   getting same save-on-close macro to work from different networklocations (https://www.excelbanter.com/excel-programming/276442-re-getting-same-save-close-macro-work-different-networklocations.html)

buczacz

getting same save-on-close macro to work from different networklocations
 
Thanks for the prompt reply, BUT..

I've not been able to use the environ() function to identify the machine
on which the program is running, possibly because it is was not yet an
easily accessed feature at the time my version of Excel (Excel97) and
Visual Basic were published. My reason is that the following macro
returns a blank,

Dim CompName
Sub what_machine()
CompName = Environ("COMPUTERNAME")
ActiveCell.Value = CompName
End Sub

even though (1) the machine appears to have name "Pentium_IV" when you
examine the list of things connected to my local network, (2) Visual
basic does not declare it an invalid function and (3) when I run
MSinfo32 from RUN, it shows
"On "PENTIUM_IV" as "Michael"

I also tried without success using the function Environ$ although the I
don't know when one would use Environ and when one would use Environ$.

I'm not currently anxious to upgrade to a newer version of office
because, except for this problem, EXCEL97 meets all my needs and runs
with lightning speed. Moreoverm I have noted that the function is
referred to in the context of Microsoft Visual Basic for MSDOS Version
1.0 at:

http://support.microsoft.com/default...kb;en-us;69846

This suggests that with additional code, one might be able to get the
Environ info from the operating system.


Is there another way to: (1) identify the machine on which the EXCEL
program is running or (2) specify the path, so I can tailor
SaveOnClose() to always save to the same machine????





Tom Ogilvy wrote:
Option 1 shouldn't be that hard

if environ("COMPUTERNAME") = "AMD" then

else

End if




All times are GMT +1. The time now is 05:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com