PDA

Click to See Complete Forum and Search --> : problem with replace


Wiklander
Aug 18th, 2003, 06:28 AM
Hi,
Need some help.
Writing a macro and trying to send information from a table in word to excel, It works yes, but from the word table it takes some strange character with it, so we had to use a replace command to get rid of those two characters that followed along.
It works fine i excel but the replace command doesent seem to work in word, and there is the problem, is there anything else I can use to do the same thing as below
Here is the code I use:

Dim objApp As Object
Dim objExcel As Object
Dim mycell As Object

Dim strCurrent As String
Dim strReplaced As String
Dim test As Integer
Dim test2 As Integer


Set mycell = ActiveDocument.Tables(1).Cell(Row:=1, Column:=1)
Set objeApp = CreateObject("Excel.Application")
Set objExcel = objeApp.Workbooks.Open("C:\Ky\Test\apa2.xls")

test = Len(mycell)
test2 = test - 1

strReplaced = Application.WorkbooksFunction.Replace _
(Arg1:=mycell, Arg2:=test2, _
Arg3:=2, Arg4:="")

objExcel.Worksheets("blad1").Range("A1").Value = mycell

Thanks for all help

Spajeoly
Aug 19th, 2003, 03:14 AM
Your not telling it to remove a character, your telling it to remove an integer.