Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I am saving files based on a number and in the macro I need the user
to input the number for the file they wish to open and have the rest of the macro continue. Right now I am using an InputBox to have the user input the information but I dont know how to use the variable that saves the users information and have it apart of the Open Filename command. This does not work because that command needs to have text and it wont let me put a variable in there. Any suggestions? |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Perhaps...
Sub a() Dim FileNum As Integer On Error Resume Next FileNum = InputBox("Enter file number") If Err.Number = 0 Then Workbooks.Open "File" & FileNum If Err.Number = 0 Then ''file opened ok Else MsgBox "Could not open file" End If Else MsgBox "Invalid file number" End If End Sub -- Jim wrote in message oups.com... |I am saving files based on a number and in the macro I need the user | to input the number for the file they wish to open and have the rest | of the macro continue. Right now I am using an InputBox to have the | user input the information but I dont know how to use the variable | that saves the users information and have it apart of the Open | Filename command. This does not work because that command needs to | have text and it wont let me put a variable in there. Any suggestions? | |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
On Mar 27, 2:23 pm, "Jim Rech" wrote:
Perhaps... Sub a() Dim FileNum As Integer On Error Resume Next FileNum = InputBox("Enter file number") If Err.Number = 0 Then Workbooks.Open "File" & FileNum If Err.Number = 0 Then ''file opened ok Else MsgBox "Could not open file" End If Else MsgBox "Invalid file number" End If End Sub -- wrote in message oups.com... |I am saving files based on a number and in the macro I need the user | to input the number for the file they wish to open and have the rest | of the macro continue. Right now I am using an InputBox to have the | user input the information but I dont know how to use the variable | that saves the users information and have it apart of the Open | Filename command. This does not work because that command needs to | have text and it wont let me put a variable in there. Any suggestions? | This works great, do you know if there is a way to set a directory so the program knows where to look for the file the user will specify. Thank you. |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
take one step in between. Define a string that contains the filename. Based
on the feedback from the inputbox add the number to the string - the result is again a string. Thus MyFilename = MyFilename & inputbox thereafter use the open command " wrote: I am saving files based on a number and in the macro I need the user to input the number for the file they wish to open and have the rest of the macro continue. Right now I am using an InputBox to have the user input the information but I dont know how to use the variable that saves the users information and have it apart of the Open Filename command. This does not work because that command needs to have text and it wont let me put a variable in there. Any suggestions? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Have user input converted to uppercase in same cell as input? | New Users to Excel | |||
Excel 2003 crashes when opening a file from one particular user | Excel Discussion (Misc queries) | |||
restrict a user from opening a dbf file from excel? | Excel Discussion (Misc queries) | |||
How do I deny opening and viewing any file to any user and lock i. | Excel Discussion (Misc queries) | |||
restrict opening Excel file residing on a shared drive to one user | Excel Discussion (Misc queries) |