LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Programmatic indication of file to be PROCESSED.

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
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
The query could not be processed: Error opening data file Hassan[_2_] Charts and Charting in Excel 2 March 13th 08 05:53 PM
The query could not be processed: Error opening data file Hassan[_3_] Excel Discussion (Misc queries) 1 March 13th 08 05:53 PM
Autofilter indication when being used Cheese Excel Discussion (Misc queries) 1 July 8th 05 07:18 AM
Foreign characters aren't processed in a macro Paul hampson Excel Programming 0 August 12th 04 01:43 PM
time indication bar Jos reulen Excel Programming 0 November 24th 03 10:05 AM


All times are GMT +1. The time now is 12:41 PM.

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"