opening files with macros

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

I am writing a macro that prompts a user to enter two values. These values
are need to open certain files on the computer. The two values are two
folders the document is located under. I am getting the error "divide by zero"

Here's my code:

Sub Macro2()

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

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

Im sure it's just a coding problem that I can't see. Any help would be
greatly appreciated. Have been stuck for 2 days! Am making progress though
thanks to replies!

MSHO
 
Watch your quotes:

Application.GetOpenFilename("C:\Documents and Settings\" & _
"All Users\Documents\Coop Students\Small Package Rates\UPS rates\" & nm _
& "\ Air \ " & filetypenm)
 
I tried doing that but now its saying that it fails. May I ask what the
underscores are for? I'm having such a difficult time trying to open these
files.
 
The space character followed by the underscore character is VBA's line
continuation symbol.

I'd check the validity of the folder name and filetypenm.
 
Back
Top