Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Open file with macros
Hello all-
I have a macro that opens a file on my network when I click on button. I want this macro to open a file that is in cell(14,1) no matter what the file's name is changed to. I've attached my current macro below. If I change the actually file name in VBA code, then it works fine. But i want to be able to change the file name in the Excel worksheet instead. Private Sub CmdWireSheet_Click() Dim objExcel As Object Dim SchedWkbk As Workbook On Error Resume Next Set SchedWkbk = Nothing Set objExcel = CreateObject("Excel.Application") Set SchedWkbk = objExcel.Application.Workbooks.Open _ ("O:\SEM\Common\Accounting\& .cells(14,1).value") objExcel.Visible = True On Error Resume Next If SchedWkbk Is Nothing Then MsgBox prompt:="Cannot find file. Please open file manually", _ Buttons:=vbOKOnly + vbQuestion End If End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Save or open file as YYYYMMDD in Macros, how to record it | Excel Discussion (Misc queries) | |||
How can I save or open file as YYYYMMDD in Macros | Excel Discussion (Misc queries) | |||
In Excel - Use Windows Explorer instead of File Open to open file | Excel Discussion (Misc queries) | |||
How to stop file open macro prompt after deleting all macros? | Excel Worksheet Functions | |||
save excel file from a table delimited file (.txt) using macros | New Users to Excel |