Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
kem kem is offline
external usenet poster
 
Posts: 1
Default User Input File Name

I want to be able to call a workbook (to copy data from)
based on the file name that the user inputs. The workbook
to be called would be already open (but there would likely
be other workbooks also open at the same time).

I tried something like this:

Dim RawDataSheet As String
RawDataSheet = InputBox("What is the name of the file
that contains the raw data?")
Windows("RawDataSheet").Activate
Range("A1").Select

Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default User Input File Name

You put your variable name in quotes. That won't work, unless you have a
window with a caption of RawDataSheet. Try:

Dim RawDataSheet As String
RawDataSheet = InputBox("What is the name of the file
that contains the raw data?")
Windows(RawDataSheet).Activate
Range("A1").Select


You may want to do something like "If Left(RawDataSheet, 4) < ".xls" Then
RawDataSheet = RawDataSheet & ".xls" or put in some sort of error handling
at least.

Ray at work


"kem" wrote in message
...
I want to be able to call a workbook (to copy data from)
based on the file name that the user inputs. The workbook
to be called would be already open (but there would likely
be other workbooks also open at the same time).

I tried something like this:

Dim RawDataSheet As String
RawDataSheet = InputBox("What is the name of the file
that contains the raw data?")
Windows("RawDataSheet").Activate
Range("A1").Select

Thanks in advance



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default User Input File Name

kem

One method(among others).

Dim RawDataSheet As String
RawDataSheet = InputBox("What is the name of the file_
that contains the raw data?")
Application.Workbooks(RawDataSheet & ".xls").Activate
Range("A1").Select
End Sub

Gord Dibben Excel MVP - XL97 SR2 & XL2002

On Mon, 14 Jul 2003 13:28:35 -0700, "kem" wrote:

I want to be able to call a workbook (to copy data from)
based on the file name that the user inputs. The workbook
to be called would be already open (but there would likely
be other workbooks also open at the same time).

I tried something like this:

Dim RawDataSheet As String
RawDataSheet = InputBox("What is the name of the file
that contains the raw data?")
Windows("RawDataSheet").Activate
Range("A1").Select

Thanks in advance


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
macro to save as a data input by user file name from a designated Brian Excel Discussion (Misc queries) 2 November 20th 07 04:00 AM
Prompt user for input and utilize that input ninner Excel Worksheet Functions 2 March 28th 07 09:44 PM
Opening a file with User Input [email protected] Excel Discussion (Misc queries) 3 March 28th 07 03:00 AM
Have user input converted to uppercase in same cell as input? Shannonn New Users to Excel 1 June 20th 06 03:19 AM
INDEX, user input? chris w Excel Worksheet Functions 3 December 10th 04 06:07 PM


All times are GMT +1. The time now is 11:32 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"