Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2007

Tip: Looking for answers? Try searching our database.

Send Text String

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Benz - 27 Sep 2007 22:06 GMT
Hi,

I have a toolbar that contains a textbox - im trying to have it copy the
text to the first empty cell in an existing excel doc.  I have most of it
complete but im having trouble actually getting the data over to excel.

THis is (part) the code I was trying that obviously isint correct:

Set oWB = oXL.Workbooks.Open(FileName:=WorkbookToWorkOn)

Sheets("ToDos").Cells(Cells(Rows.Count, 1) _
       .End(xlUp).Row, 1).Offset(1, 0) = Paste

I would apprecaite any help!

Ben Z.
Helmut Weber - 28 Sep 2007 02:46 GMT
Hi Ben,

given that the rest of you code is working:

Sub Macro12()
' early binding
' excel already running
Dim sendbar As CommandBar
Dim sendbox As CommandBarControl
Set sendbar = Application.CommandBars("Custom01")
Set sendbox = sendbar.Controls(1)
Dim oXlc As Excel.Application
Dim oWrk As Excel.Workbook
Dim oSht As Excel.Worksheet
Set oXlc = GetObject(, "Excel.application")
Set oWrk = oXlc.Workbooks.Open("c:\test\Excel\liste2.xls")
Set oSht = oWrk.Worksheets(1)
oSht.Cells(1, 1).Value = sendbox.Text
End Sub

Without loooking it all up myself,
I wouldn't know whether it makes sense or is correct.

Where should the text from the sendbox go to?

>Cells(Cells(Rows.Count, 1).End(xlUp).Row, 1).Offset(1, 0)

in any case, before "cells" the object it refers to is missing.

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.