View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] koobelek@hotmail.com is offline
external usenet poster
 
Posts: 2
Default Copy text from Ms Access record to Excel text box

When I execute code and click on the button the text does not appear in
the textbox. The rest of the code seems to be working except that "text
box" thing. What am I doing wrong?


Private Sub Command105_Click()

Dim strText As Variant
Dim FirstRec As String
Dim LastRec As String

Set RecSet = Me.RecordsetClone

FirstRec = InputBox("First record: ", "First record", 0, 0, 0, 0, 0)

RecSet.MoveFirst


Set ExcelApp = CreateObject("Excel.Application")
With ExcelApp
..Workbooks.Open "Q:\DATA\PRODUCTION\NPDJG.XLS"
..Visible = True
End With

Me.Current_Situation.SetFocus

RecSet.Move (Int(FirstRec))

Set WSheet = ExcelApp.Worksheets(1)
strText = Me("Current Situation").Value

'WSheet.Shapes("Text Box 2").Select
WSheet.Shapes("Text Box 2").TextFrame.Characters.Text = strText


'Set ExcelApp = Nothing
'Set WSheet = Nothing

End Sub