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 |
All times are GMT +1. The time now is 04:27 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com