P
philip88ga
This doesn't happen if I load the data manually. Please help.
Tried many googles and searches.....
Here's macro that loads the data;
Private Sub GetCallout_Click()
Application.ScreenUpdating = False
Dim wdApp As Object
Dim wdDoc As Variant
Application.EnableEvents = False
Worksheets("CallOut").Range("A1:Z999").ClearContents
Application.EnableEvents = True
Worksheets("CallOut").Activate
ActiveSheet.Range("A1").Select
CalloutDate = InputBox("Enter the Callout Date (mmddyyyy)",
"Callout Date")
Set wdApp = CreateObject("Word.application")
On Error GoTo fnf
wdApp.documents.Open Filename:="S:\Callout\" & CalloutDate &
"MSU.doc"
wdApp.documents(1).Select
wdApp.Selection.Copy
ActiveSheet.Paste
wdApp.Quit
Set wdApp = Nothing
Set wdDoc = Nothing
Worksheets("WorkHrs").Activate
Sheets("WorkHrs").Range("b4").Copy
Application.CutCopyMode = False
ActiveSheet.Range("A1").Select
Application.ScreenUpdating = True
Exit Sub
fnf:
Call FNFX
End Sub
Here's Nth_Occurence function;
Function Nth_Occurrence(range_look As Range, find_it As String,
occurrence As Long, offset_row As Long, offset_col As Long)
Dim lCount As Long
Dim rFound As Range
Set rFound = range_look.Cells(1, 1)
For lCount = 1 To occurrence
Set rFound = range_look.Find(find_it, rFound, xlValues,
xlWhole)
Next lCount
Nth_Occurrence = rFound.Offset(offset_row, offset_col)
End Function
Tried many googles and searches.....
Here's macro that loads the data;
Private Sub GetCallout_Click()
Application.ScreenUpdating = False
Dim wdApp As Object
Dim wdDoc As Variant
Application.EnableEvents = False
Worksheets("CallOut").Range("A1:Z999").ClearContents
Application.EnableEvents = True
Worksheets("CallOut").Activate
ActiveSheet.Range("A1").Select
CalloutDate = InputBox("Enter the Callout Date (mmddyyyy)",
"Callout Date")
Set wdApp = CreateObject("Word.application")
On Error GoTo fnf
wdApp.documents.Open Filename:="S:\Callout\" & CalloutDate &
"MSU.doc"
wdApp.documents(1).Select
wdApp.Selection.Copy
ActiveSheet.Paste
wdApp.Quit
Set wdApp = Nothing
Set wdDoc = Nothing
Worksheets("WorkHrs").Activate
Sheets("WorkHrs").Range("b4").Copy
Application.CutCopyMode = False
ActiveSheet.Range("A1").Select
Application.ScreenUpdating = True
Exit Sub
fnf:
Call FNFX
End Sub
Here's Nth_Occurence function;
Function Nth_Occurrence(range_look As Range, find_it As String,
occurrence As Long, offset_row As Long, offset_col As Long)
Dim lCount As Long
Dim rFound As Range
Set rFound = range_look.Cells(1, 1)
For lCount = 1 To occurrence
Set rFound = range_look.Find(find_it, rFound, xlValues,
xlWhole)
Next lCount
Nth_Occurrence = rFound.Offset(offset_row, offset_col)
End Function