Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default macro open files

Im trying to write a macro to prompt a user to select a file and then open it.

This is the link to the file that I keep trying:
C:\Documents and Settings\All Users\Documents\Coop Students\Small Package
Rates\UPS rates\2006\Air\

The file is then in that Air folder.

The year (2006) is the second input box and the file name is the first.

This is what i have so far:
I keep getting error- GetOpenfilname application failed

Sub Macro112_4()


Dim filetypenm As String
filetypenm = InputBox("Enter File Name you would like to compare")

Dim nm As Integer
nm = InputBox("Enter Year you would like to compare")
Application.GetOpenFilename (["C:\Documents and
Settings\AllUsers\Documents\Coop Students\Small Package Rates\UPS rates\" &
nm & "\Air\" & filetypenm])


End Sub


HELP PLEASE!

Thanks in advance,

Mikayla
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default macro open files

I don't have the macro so I can't test this but a lot of the file
access functions do not like expressions in the function. You can avoid
this by creating a temporary string to hold the value you are
evaluating. Try adding:

Dim myFileName as String
myFileName = "C:\Documents and Settings\AllUsers\Documents\Coop
Students\Small Package Rates\UPS rates\" & nm & "\Air\" & filetypenm

and changing the action to:

Application.GetOpenFilename(myFileName)

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
open files run macro Steve Excel Discussion (Misc queries) 3 June 13th 08 10:43 PM
Macro for multiple open files [email protected] Excel Discussion (Misc queries) 1 February 13th 06 03:25 AM
Macro Open Files MSHO Excel Programming 2 January 11th 06 11:06 PM
Macro to open *.dat files and save as .txt (comma delimited text files) [email protected] Excel Programming 2 November 30th 05 05:50 AM
Files won't open after running a macro TimZ Excel Programming 0 May 25th 05 01:58 PM


All times are GMT +1. The time now is 05:36 AM.

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

About Us

"It's about Microsoft Excel"