Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi I have the following code:
If Workbooks("Analysis.xls").Worksheets("Names").Cell s(2, 3)="" Then txtPass = InputBox("Please Insert Your Login") Else txtPass = Workbooks("Analysis.xls").Worksheets("Names").Cell s(2, 3).Value End If What code should I add in order that if the Workbooks("Analysis.xls") is not opened continues the macro still runs txtPass = InputBox("Please Insert Your Login") in the next line Regards, Pedro |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Pedro,
Here's one way Dim txtPass Dim oWB As Workbook On Error Resume Next Set oWB = Workbooks.Open("Analysis.xls") On Error GoTo 0 If oWB Is Nothing Then txtPass = InputBox("Please Insert Your Login") Else txtPass = oWB.Worksheets("Names").Cells(2, 3).Value End If -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Pedro" wrote in message ... Hi I have the following code: If Workbooks("Analysis.xls").Worksheets("Names").Cell s(2, 3)="" Then txtPass = InputBox("Please Insert Your Login") Else txtPass = Workbooks("Analysis.xls").Worksheets("Names").Cell s(2, 3).Value End If What code should I add in order that if the Workbooks("Analysis.xls") is not opened continues the macro still runs txtPass = InputBox("Please Insert Your Login") in the next line Regards, Pedro |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Error Resume Next
set wkbk = Workbooks("Analysis.xls") On Error goto 0 if not wkbk is nothing then If Workbooks("Analysis.xls").Worksheets("Names").Cell s(2, 3)="" Then txtPass = InputBox("Please Insert Your Login") Else txtPass = Workbooks("Analysis.xls"). _ Worksheets("Names").Cells(2,3).Value End If Else Pass = InputBox("Please Insert Your Login") End if -- Regards, Tom Ogilvy "Pedro" wrote in message ... Hi I have the following code: If Workbooks("Analysis.xls").Worksheets("Names").Cell s(2, 3)="" Then txtPass = InputBox("Please Insert Your Login") Else txtPass = Workbooks("Analysis.xls").Worksheets("Names").Cell s(2, 3).Value End If What code should I add in order that if the Workbooks("Analysis.xls") is not opened continues the macro still runs txtPass = InputBox("Please Insert Your Login") in the next line Regards, Pedro |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry misread it, it should be
Dim txtPass Dim oWB As Workbook On Error Resume Next Set oWB = Workbooks("Analysis.xls") On Error GoTo 0 If oWB Is Nothing Then txtPass = InputBox("Please Insert Your Login") Else txtPass = oWB.Worksheets("Names").Cells(2, 3).Value End If -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Bob Phillips" wrote in message ... Pedro, Here's one way Dim txtPass Dim oWB As Workbook On Error Resume Next Set oWB = Workbooks.Open("Analysis.xls") On Error GoTo 0 If oWB Is Nothing Then txtPass = InputBox("Please Insert Your Login") Else txtPass = oWB.Worksheets("Names").Cells(2, 3).Value End If -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Pedro" wrote in message ... Hi I have the following code: If Workbooks("Analysis.xls").Worksheets("Names").Cell s(2, 3)="" Then txtPass = InputBox("Please Insert Your Login") Else txtPass = Workbooks("Analysis.xls").Worksheets("Names").Cell s(2, 3).Value End If What code should I add in order that if the Workbooks("Analysis.xls") is not opened continues the macro still runs txtPass = InputBox("Please Insert Your Login") in the next line Regards, Pedro |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to: Open closed workbook/Search data tables/Return data to open workbook | Excel Discussion (Misc queries) | |||
Opening Excel, Book1 opens, remains open with other workbook open | Excel Discussion (Misc queries) | |||
how do i open a data workbook when i open a timesheet workbook | Excel Discussion (Misc queries) | |||
excel 2003 saved file will not open without a blank workbook open | Excel Discussion (Misc queries) | |||
Search open sheets in workbook and insert into open sheet | Excel Discussion (Misc queries) |