How would I do the same thing with the file name as varible?
Control Button name is "Open_Existing_Job_Folder_Label_9"
Open ??.xls file?
Code:
--------------------
Private Sub Open_Exsisiting_Job_Folder_Label_9_Click()
Folder = "c:\temp\"
FName = Dir(Folder & "*.xls")
do while FName <> ""
Set bk = Workbooks.Open(Filename:=Folder & FName)
bk.close savechanges:=false
FName = dir()
loop
End Sub
--------------------
Also how can I setup the Print Control Button to use the Print dialog
box
that excel uses, where the user can pick the printer and settings.?
Code:
--------------------
Set printdialog = Application.Dialogs(xlDialogPrint)
dlgAnswer = printdialog.Show
--------------------
Is it possible to set the File Save as File Name from User Form Box
Names?
Example:
"TEO_No_1 CLLI_Code_1 CES_No_1 TEO_Appx_No_2.xls"
Code:
--------------------
set bk = thisworkbook
bk.saveas filename:=TEO_No_1.value
bk.saveas filename:=CLLI_Code_1.value
bk.saveas filename:=CES_No_1.value
bk.saveas filename:=TEO_Appx_No_2.xls.value 'while do you have .xls?
I would put the folder name like this
Folder = "c:\temp\"
set bk = thisworkbook
bk.saveas filename:=Folder & TEO_No_1.value
bk.saveas filename:=Folder & CLLI_Code_1.value
bk.saveas filename:=Folder & CES_No_1.value
bk.saveas filename:=Folder & TEO_Appx_No_2.xls.value 'while do you have .xls?
--------------------
Thanks Again
joel said:
Private Sub Open_Exsisiting_Job_Folder_Label_9_Click()
fileToOPen = Application _
.GetOpenFilename("Excel Files (*.xls), *.xls")
If fileToOPen = False Then
MsgBox ("Cannot Open file - exiting Macro")
Exit Sub
End If
Set bk = Workbooks.Open(Filename:=fileToOPen)
End Sub
--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: 'Opening Workbook from User Form - The Code Cage
Forums' (
http://www.thecodecage.com/forumz/showthread.php?t=164934)
'Microsoft Office Help' (
http://www.thecodecage.com)
.
--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread:
http://www.thecodecage.com/forumz/showthread.php?t=164934
Microsoft Office Help
.