Open Workbook w/VBA: does not allow user interaction

lsteffen

Board Regular
Joined
May 11, 2006
Messages
111
Hello,

I am using VBA in my workbook to automatically open another workbook, then it will pause, so that the user has time to run a macro in the open workbook that has another macro attached to it. However, when it pauses, the user has no interaction with the open workbook. Can someone help?

Here is the code:

'//Open File to create LT file
Workbooks.Open Filename:="\\chester2\public$\Shared Folders\Wagner\" & "LTImportFileBuilder_ddc.xls"
ActiveWorkbook.Sheets("Sheet1").Activate
Range("A2:A201").Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A1").Select

'//User to run the macro to create the import file
MsgBox "Press the CREATE IMPORT FILE button, press OK to close this box."

'//Pause for 15 seconds for user to run macro
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 15
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
If Application.Wait(Now + TimeValue("0:00:15")) Then
MsgBox "Press OK to continue..."
End If

Any help is appreciated.

Thank you,
Liz :huh:
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Liz

Why not just run the other macro from the code?
 
Upvote 0
Hi Norie,

I tried, but it gave me a lot of errors. Here is the code from the other macro:

Option Explicit

Const HEADER = "H,Bundle,608250,Prod.Ctr.,,07/11/2002,13:30:51,,,,,,,,,MSC,,1,,,,,,,,,,,,,,,,,,,"

Function MakeTagImport()
Dim hdr As String
Dim GetWorkOrder As String
Dim CreateFileName
Dim i
'GetWorkOrder = InputBox("Enter The Work Order Number", "LUMBER TRACK WORK ORDER NUMBER", "MSC" & CDbl(Now))


hdr = HEADER '"H,Bundle," & GetWorkOrder & ",Prod.Ctr.,,07/11/2002,13:30:51,,,,,,,,,MSC,,1,,,,,,,,,,,,,,,,,,,"
Worksheets("sheet1").Activate
i = 1
Range("a1").Activate
Do Until ActiveCell = ""
ActiveCell.Offset(i, 0).Activate
If ActiveCell.Value = "" Then
Exit Do
End If
'hdr = hdr & vbCrLf & "D," & rs!prodid
hdr = hdr & vbCrLf & "D," & ActiveCell.Value
'i = i + 1
'rs.MoveNext
Loop
Debug.Print hdr
CreateFileName = "CON_" & "608250" & "_020911_154750.txt"
'CON_601826_020911_154750.TXT
Open "c:\" & CreateFileName For Output As #1
Print #1, hdr
Close #1
End Function

Liz
 
Upvote 0
Liz

What errors?

Why not just fix the errors?
 
Upvote 0
Hi Norie,

What helped was to just call the other code from my code like you first suggested.

Thank You!

Liz :-D
 
Upvote 0

Forum statistics

Threads
1,223,196
Messages
6,170,662
Members
452,345
Latest member
ye4hb0i

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top