#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default File Path

Hi.

Sub test()
Dim strPath As String

strPath = CreateObject("WScript.Shell").SpecialFolders("MyDo cuments")
Debug.Print strPath
End Sub

Cheers,
Rob


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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
File Path Too Long? Not Anymore! Check out Long Path Tool Max Loger Excel Discussion (Misc queries) 1 March 24th 17 07:59 AM
http://CannotDeleteFile.net - Cannot Delete File? Try Long Path ToolFilename is too long? Computer Complaining Your Filename Is Too Long? TheLong Path Tool Can Help While most people can go about their businessblissfully unaware of the Windo Max Loger Excel Discussion (Misc queries) 0 June 14th 11 04:30 PM
Creating Excel file that points to relative path .cub file NewUser1 Excel Programming 0 January 11th 08 03:59 PM
Formula too long - new file path is shorter than old file path - Excel 2003 Greg J Excel Worksheet Functions 1 November 22nd 06 05:16 PM
How set file open path to filepath of file opened with Explorer ? RandyDtg1 Excel Programming 0 May 14th 04 02:05 AM


All times are GMT +1. The time now is 04:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"