Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WHY DOES Set rngWithData fail?

Status
Not open for further replies.

WBURKERT

Technical User
May 28, 2010
73
Here is a short portion of a WORD marco that fails executing the Line Set rngWithData. I have a great understand for programing logic but the syntax is beating me up.

Sub Section_X_to_Word_Table_at_Bookmark_X()

'WORD variables

Dim docDest As Word.Document
Dim Goods As Word.Table
Dim oCell As Word.Cell
Dim s As Long

'EXCEL variables

Dim appXL As Excel.Application
Dim rngWithData As Excel.Range
Dim mySpreadsheet As Excel.Workbook
Dim aryWithData, i As Integer, j As Integer

'row/column counters

Dim RowCount As Long
Dim ColCount As Long

For s = 1 To 5
'****************************************************************************************
'****************************************************************************************
Set appXL = CreateObject("Excel.Application")
Set mySpreadsheet = GetObject("F:\My Documents™\list\LIST.xls")
Set rngWithData = mySpeadsheet.Worksheets("Sec" & s).Range("Print_Area")
 
NEVER MIND

SPELLING COUNTS! I AM AN IDTENT.
 
Are you using Option Explicit? I think I asked this before.

If you are not, start using it NOW.

Gerry
 
Got It, thanks. You may make me a disciplined VBA programmer yet! Everyday I think of new and better and faster ways of accomplishing tasks.
 
It is all a learning experience, and we all had to start somewhere. Keep at it!

and yes...spelling does count. The "IDTENT" was pretty funny.

BTW: when posting code please use the TGML code tags. Click "Process TGML" to see the many ways to format your postings. Thanks.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top