The structure of the my program is like this::

i. macro run the main function
ii. main function calls up open_from_txt
iii. open_from_txt open the text data file
-- read one line at a time
-- calls up Modify_DWG (another function that modify the drawings)
-- read the next line and calls up Modify_DWG again until end of file

[VBA]
Sub open_from_txt
Dim TXT_FILE As String

'open the text file that contain all the drawings that need to be print
TXT_FILE = "C:\Documents and Settings\CAD4\Desktop\GaryLee\AutoCad Programming\File_To_Print.txt"
Open TXT_FILE For Input As #1

'read until end of file
Do While Not EOF(1)
Input #1, DWG 'assign the dwgs' path to variable DWG
Modify_DWG 'another function that modify the drawings
Loop

Close #1

End Sub
[/VBA]

Right now I use a text file to store all the drawings' path.
I would like to use the "select file" window to update my drawings' path

***select file window***



I have two ideas in my head.

1st: continue use the text file, update the text file everytime
2nd: don't use the text file, instead, use a string array to store the paths

I know how to do the input/output and array.

My first question is : how to obtain the drawing's path info when using
the windows built up "select file window" function??

I did borland programming for so long but I am new to Visual.
There are lots of visual functions are new to me.

My second question is : how can I pass varaible into
CommandButton1_Click() function ??

My Third question is : how can I refer to a varaible(declared in other sub)
when I am in the CommandButton1_Click() function. "For example I would like to use the value of the TXT_FILE(declared in the ThisDrawing/ open_from_txt sub) when I am in the userform1/CommandButton1_Click() function"

I have three questions in total, please feel free to reply to any of them

thank you very mcuh

gary lee