RE: Recording a Macro

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



CIt probably doesn't like this part of thhe code
Chr(13) & "" & Chr(10)

I don't thin you need a double quote between a charrage return (chr(13)) and
a line feed (chr(10)).

It should be just
Chr(13) & Chr(10)

If the double quotes are needed to prevent a syntax error use
Chr(13) & chr(34) & Chr(10)

"geocoy" wrote:

I am recording this macro and when I try to run it the second time I get a
Syntax error message. The interesting thing is, I have recorded this macro
several times and the error message is not alway the same. Originally it was
erroring on a fragment of code where "ch(14) & ch(10)" saying it couldn't
find the Project Library. What is missing? The macro works when I initially
record it, but when I try to replay it, it fails.

Cells.Select
Selection.ClearContents
Range("B4").Select
With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _
"ODBC;DBQ=C:\Documents and Settings\george.coy\My
Documents\QualityReports\QualityFront.mdb;DefaultDir=C:\Documents and
Settings\georg" _
), Array( _
"e.coy\My Documents\QualityReports;Driver={Microsoft Access Driver
(*.mdb)};DriverId=25;Exclusive=0;FIL=MS Access;MaxBufferSize=2" _
), Array( _

"048;MaxScanRows=8;PageTimeout=5;;ReadOnly=1;SafeTransactions=0;SystemDB=C:\Documents and Settings\george.coy\My Documents\Qualit" _
),
Array("yReports\QualityDb\QUALITY.MDW;Threads=3;UID=gcoy;UserCommitSync=Yes;"
_
)), Destination:=Range("B4"))
.CommandText = Array( _
"SELECT ArrisWarrantyReturns.assembly, ArrisWarrantyReturns.Built,
ArrisWarrantyReturns.CRGReceivingID, ArrisWarrantyReturns.CustomerID,
ArrisWarrantyReturns.EventID, ArrisWarrantyReturns.EventTyp, Arr" _
, _
"isWarrantyReturns.ManufBy, ArrisWarrantyReturns.MfgOrderNo,
ArrisWarrantyReturns.PlxJobNo, ArrisWarrantyReturns.ProcessTyp,
ArrisWarrantyReturns.ReasonForReturn, ArrisWarrantyReturns.ReceiveDate, Arri"
_
, _
"sWarrantyReturns.RMA, ArrisWarrantyReturns.SerialNo,
ArrisWarrantyReturns.`WarrantyBySerial#`" & Chr(13) & "" & Chr(10) & "FROM
ArrisWarrantyReturns ArrisWarrantyReturns" _
)
.Name = "Query from Quality_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
.



Relevant Pages

  • Re: Object Hash vs. object Array preference
    ... > languages. ... JavaScript/JScript Object accepts CDATA literals as property name. ... Array index is unsigned 32 bit value which allows you to hold ... sorry but I used to quote in the way one can see who am I ...
    (comp.lang.javascript)
  • Re: One new Recipe has arrived: When shall we use default variables?
    ...   :-( ... <QUOTE> ... I have an array, I need if sorted and fast. ... We may also add a comparison closure, it is very useful to sort numbers ...
    (perl.beginners)
  • Re: Help a beginner - function with pointer ...
    ... that's a syntax error ... it has been converted to type float*. ... To an extent array notation can be replaced by ... int main ...
    (comp.lang.c)
  • Re: declare variables document.write()
    ... document.write - inserts HTML contents into the HTML stream (assuming ... source code (to be the latter it would have to appear in a SCRIPT ... would only result in a syntax error as the opening double quote at the ... is not matched with a closing double quote. ...
    (comp.lang.javascript)
  • Re: Passing an array of chars to a function
    ... newalready returns a pointer. ... cast an array into a pointer, but if you don't it will be done ... You must have a bad short-term memory. ... I did quote it. ...
    (comp.lang.cpp)