ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   File Path (https://www.excelbanter.com/excel-programming/437076-file-path.html)

Max2073

File Path
 
Help needed.

I had developed a macro that was only used by myself, however this macro
will now also be used by others.

In the macro I was using the full file path, however this is now causing
some problems.

Is there anyway that I can change the macro to open the required files based
on the following path: -

c:\documents and settings\"username - logged on officer"\help.xls

The files that need to be opened are automatically named when exported from
the corporate database - the files will be named the same for each officer -
the only difference is the username.

Gary''s Student

File Path
 
Perhaps:

Sub officer()
Dim s1 As String, s2 As String, s3 As String
s1 = "C:\Documents and Settings\"
s2 = Environ("Username")
s3 = "\help.xls"
Workbooks.Open Filename:=s1 & s2 & s3
End Sub


--
Gary''s Student - gsnu200909


"Max2073" wrote:

Help needed.

I had developed a macro that was only used by myself, however this macro
will now also be used by others.

In the macro I was using the full file path, however this is now causing
some problems.

Is there anyway that I can change the macro to open the required files based
on the following path: -

c:\documents and settings\"username - logged on officer"\help.xls

The files that need to be opened are automatically named when exported from
the corporate database - the files will be named the same for each officer -
the only difference is the username.



All times are GMT +1. The time now is 08:37 AM.

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