Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I want user to have the ability to choose a workbook for processing. Now there are 2 possibilities. a) Workbook is not open in the present excel session - In that case I can use GetOpenFileName method for opening the desired file and continue with Macro operation. b) Workbook is ALREADY open in the present excel session - In that case how to offer the user the facility of indicating that so and so workbook which is already open should be used for continuing the macro operation. And how to interweave the above 2 methods. I thought of the following which am pasting here. If there is a more efficient method please tell me. (Also in my code the, macro goes in to debug mode if user writes nothing in the input box but presses a ok. How to take care of that? Also is there anything else I should be wary of while doing this?) Please guide me. Option Explicit Sub FiletobeProcessed() Dim i As Byte Dim p As String i = 0 Do i = Application.InputBox("If the file to be UPCODED is not open then write 1 else write 2", "File open or not?") If i = 1 Then p = Application.GetOpenFilename("XLS files (*.xls),*.xls") Workbooks.Open (p) ElseIf i = 2 Then ' code for condition b). I dont know how to put this code. I would like to get the _ name of the file which is already open so that I can integrate it with other Macros. _ A standard Input Box might not work as user might make a Typo in writing the name _ of the file and another its difficult to write long file names. End If Loop While Not (i = 1 Or i = 2) End Sub Thanks a lot, Hari India |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
The query could not be processed: Error opening data file | Charts and Charting in Excel | |||
The query could not be processed: Error opening data file | Excel Discussion (Misc queries) | |||
Autofilter indication when being used | Excel Discussion (Misc queries) | |||
Foreign characters aren't processed in a macro | Excel Programming | |||
time indication bar | Excel Programming |