|
-
Jan 11th, 2001, 05:42 AM
#1
When calling Microsoft word through a VB application it comes up with the Error "Cannot create Active X Component."
What could be the cause of this????????? I am using the following!
Dim oWordApp as Word.Application!!!
Should I rather use ...
Dim oWordApp as New Word.Application!!!
Would the version of Microsoft Word have any affect?? if your origninal reference was a previous version of word (97)?????????
-
Jan 11th, 2001, 05:53 AM
#2
Hyperactive Member
Need a bit more info. What syntax are you using(new, creatobject), are you early or late bound etc.
td.
"One logical slip and an entire scientific edifice comes tumbling down." - Robert M. Pirsig
[email protected]
"but if Einstein is right and God is in the details, reality requires that we sometimes get religion." - Scott Meyers.
-
Jan 11th, 2001, 09:16 AM
#3
i get the same error when i try and read a excel file thru VB.
im doing this:
Private Sub ImportPriceList(ByVal lcPriceList As String, ByVal lcStartDate As String)
Dim dbTmp As DAO.Database
Dim tblObj As DAO.TableDef
Dim loRecordset As DAO.Recordset
Dim cBand As String
Dim cRate As String
Dim nAmount As Double
Dim nMinCharge As String
Dim nIncrement As String
Dim varCommType As Variant 'This is a variant, as it may be a null
Dim cCommType As String
Dim nSetupFee As String
Dim strSQL As String
Dim i As Integer
Dim nRSCount As Integer
Dim nRowNumber As Integer
Set dbTmp = OpenDatabase(txtFile.Text, False, True, "Excel 8.0;")
Set loRecordset = dbTmp.OpenRecordset("sheet1$")
'Change maouse pointer to hourglass
Screen.MousePointer = vbHourglass
'Move first to ensure we are at start at recordset
loRecordset.MoveFirst
'Check that they are importing the right pricelist. This is only if they exported from TMS first
'And tried importing back in.
If loRecordset.Fields.Count > 7 Then
If Trim(loRecordset.Fields(7).Value) <> Trim(lcPriceList) Then
MsgBox "This is a different Pricelist!", vbOKOnly, "Wrong Pricelist"
Screen.MousePointer = vbDefault
Exit Sub
End If 'If loRecordset.collect(7).Value <> lcPriceList Then
End If 'loRecordset.Fields.Count > 6 Then
nRowNumber = 1
With loRecordset
nRSCount = 6 '.Fields.Count - 1
While Not .EOF
'Use this so it can say what row number has a null. Only checks the first 7 columns, not optional fields
For i = 0 To nRSCount
'If there is a Null in the recordset, it wont be able to be appended, so we need to check here.
If CheckNulls(.Fields(i).Value, .Fields(i).Name, nRowNumber, i) = True Or ValidateData(.Fields(i).Value, .Fields(i).Name, i) = False Then
'If ValidateData(.collect(i).Value, .collect(i).Name, i) = True
Screen.MousePointer = vbDefault
Exit Sub
End If 'CheckNulls(.collect(i).Value, .collect(i).Name) = True Then
Next i
.MoveNext
nRowNumber = nRowNumber + 1
Wend
End With 'loRecordset
'Start with loop again
With loRecordset
'Move first, as it will be at the end
.MoveFirst
While Not .EOF
cBand = .Fields(0).Value
cRate = StrConv(Left(.Fields(1).Value, 1), vbUpperCase)
nAmount = Round(.Fields(2).Value, 5)
nMinCharge = .Fields(3).Value
nIncrement = .Fields(4).Value
varCommType = .Fields(5).Value
If Len(varCommType) = 0 Or IsNull(varCommType) = True Then
varCommType = Chr(32)
Else
varCommType = StrConv(Left(varCommType, 1), vbUpperCase)
End If
cCommType = varCommType
nSetupFee = .Fields(6).Value
strSQL = "INSERT INTO XTariff (cPriceList, cstart, cBand, cRate, nAmount, nMinCharge, nIncrement, cCommType, nSetupFee )"
strSQL = strSQL + " Values ('" & lcPriceList & "', '" & lcStartDate & "', '" & cBand & "', '" & cRate & "','" & nAmount & "', '" & nMinCharge & "', '" & nIncrement & "', '" & cCommType & "', '" & nSetupFee & "' )"
goConnection.Execute (strSQL)
.MoveNext
Wend
End With 'loRecordset
Screen.MousePointer = vbDefault
MsgBox nRowNumber - 1 & " Records added to XTariff table", vbOKOnly, "Data Import"
End Sub
-
Jan 11th, 2001, 09:57 AM
#4
Hyperactive Member
"One logical slip and an entire scientific edifice comes tumbling down." - Robert M. Pirsig
[email protected]
"but if Einstein is right and God is in the details, reality requires that we sometimes get religion." - Scott Meyers.
-
Jan 11th, 2001, 10:04 AM
#5
Im trying to read the excel file into a recordset,
Set dbTmp = OpenDatabase(txtFile.Text, False, True, "Excel 8.0;")
Set loRecordset = dbTmp.OpenRecordset("sheet1$")
'Change maouse pointer to hourglass
Screen.MousePointer = vbHourglass
'Move first to ensure we are at start at recordset
loRecordset.MoveFirst
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|