Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Junior Member
 
Posts: 21
Default Running Macro "Logged Off" & Copy/Paste from WORD .rtf into EXCEL .xls

EXCEL 2003 VBA:

I have several Macro Projects, using .xlA files, stored on my local
hard drive; each has a 'Public Sub Auto_Open' stmt. Each .xlA file is
fired by a Windows XP 'Scheduled Task' that includes Scheduled Times
when my machine is "logged off" from our network. These macros, when
running in a "logged off" mode, have read and write access to the same
network drives that I have permissions for when my machine is "logged
on". (The .xlA files are NOT set-up as 'Add-Ins' in EXCEL.) These
macros are working as intended.

Now, I need to complete a similar macro that has a 'copy/paste from
WORD' procedure. I have been able to do this, using both late and
early binding, when my machine is "logged-on" to our network. However,
I also need to do this when my machine is "logged-off"; neither early
nor late binding is working -- the primary data file becomes "locked
for editing" by the network. (The VBA code is in a .xlA file stored on
my hard drive; a Scheduled Task opens this file at a specified time
each day.) The Scheduled Task fires, but becomes locked in "Running"
mode. We are running Office 2003 and Windows XP Pro.

Below is my early binding code procedu

Public Sub Import_From_WORD_Tables()

Dim objWord As Word.Application
Dim objDoc As Word.Document
Dim wordvalue As Variant
Dim j As Integer

Dim lngErrNo As Long
Dim strErrSrc As String
Dim strErrDesc As String

On Error GoTo PROC_ERR

Application.DisplayAlerts = False
PrimaryDataWB.Activate '<<== this is primary data file
Set objWord = New Word.Application
objWord.Visible = False

Set objDoc = Documents.Open(myPathPF_BATCH & "T and A.rtf")
objDoc.Activate

'For "Rows" 1 - 8 in Table 1
For j = 1 To 8
wordvalue = objDoc.Tables(1).Columns(4).Cells(j + 2)
ActiveWorkbook.Sheets(3).Cells(j + 17, 11) =
Application.WorksheetFunction.Clean(wordvalue)
Next j

objDoc.Close
objWord.Quit

Set objDoc = Nothing
Set objWord = Nothing

Exit Sub

PROC_ERR:
lngErrNo = Err.Number
strErrSrc = "-ADJUSTMENT_TEST()-" & Err.Source
strErrDesc = Err.Description

'Disable error handling
On Error GoTo 0

Err.Raise lngErrNo, strErrSrc, strErrDesc

End Sub

I have been able to determine that the macro crashes at the 'Set
objWord = ...' statement above.
Since I am running this logged-off, the above error trapping is doing
nothing for me. Any ideas?

TIA, I appreciate your help.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MACRO: Selecting "Cancel" from a drop down to copy and paste entirerow to another sheet Nicole Hannington Excel Discussion (Misc queries) 1 July 20th 09 07:11 PM
MACRO: Selecting "Cancel" from a drop down to copy and paste entirerow to another sheet Nicole Hannington Excel Worksheet Functions 1 July 20th 09 06:51 PM
problem with Linking workbooks via "copy" and "paste link" Arkitek Excel Discussion (Misc queries) 0 December 19th 06 10:03 PM
Sheets("Rpt").Copy different results from running in macro than off excel menu?? tmbo Excel Discussion (Misc queries) 7 August 9th 06 01:13 PM
Would like to change all "yes" cells in a worksheet with "logged" Kezza Excel Programming 5 May 10th 06 02:12 PM


All times are GMT +1. The time now is 12:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"