How Can I Populate Data To Embedded Excel OLE In Form??
Thank you for Your interest.. First, I used MSFlexGrid control to display data However, My client want to copy and paste some part of the data to other Office application. So, I thought I have to use Embedded Excel using OLE control so that I don't worrry about the copy paste feature.. But, I don't know how to populate data into the embeded Excel OLE in run time.. I tried all ways.. like following..(feel stupido... --.-- ) Please help me.. I need code snippet. Or If you have any example using this feature..I will be big help or link...
Dim sheet As Excel.Sheets Dim worksheet As Excel.worksheet MsgBox OLE1.Class Set sheet = CreateObject(OLE1.Class) worksheet = sheet(0)
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Excel Sheet Embedded In Form
I am writing a code in VB6 and I want an excel sheet to be embedded in one of my forms. I tried using the code from other threads but when i say exob.visible = true, it shows the excel sheet in MS Excel, and not inside the form in which i wrote the code.
Now for my 2nd problem. Assuming I have a certain number of rows(variable) when the form opens the excel sheet and I make a new entry(entire row) in the excel sheet. How do I program my form so that I can extract the cell values not knowing(i.e without hard coding) the row number that was last entered.
Thirdly, is there a way to call a VB procedure using some action(tab press or return press) in the excel sheet. I want some cell values extracted as soon as a couple of entries are entered in a row and the rest of the row entries extracted when all entries are made in the row.
I know my question was long and wierd. But hope you can help me out, give me some code as a solution.
Thanks.
jjjhhh
How To Populate Excel With SQL Data With VB6
Dear Sirs/Madams
I need help before the end of today. Here's my problem.
I have to automate the process of quering a sql database and populating an Excel spreadsheet with the resulting data using VB6. The program contains a form with one command button that the user will click to set the process going. After clicking the button, the program will carry out the query, BUT for only the months gone by, that is from January till the end of April.
So far I am able to connect to the database using a class and ADO, heres a portion of that code
Code:
Public Function dbString(ByVal DBServer As String, ByVal DBName As String) As String
dbString = "Provider=SQLOLEDB.1;Password=Nbf4Ecom;Persist Security Info=True;User ID=GyWeb;"
dbString = dbString & "Initial Catalog=" & DBName & ";"
dbString = dbString & "Data Source=" & DBServer & ";"
End Function
Private Sub Command1_Click()
Dim i As Integer
Dim a
Dim rs As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim cn As New ADODB.Connection
Dim SQL As String
Dim SQL2 As String
Dim SQL3 As String
Dim INIReader As New clsLocation
INIReader.getSettings
cString = dbString(INIReader.DBServer, INIReader.DBName2)
Set INIReader = Nothing
cn.Open cString
SQL = "select * from service_providers" [color=Teal]This works fine
SQL2 = "select * from cb"
SQL3 = "select a.sp_name, sum(b.qty) as inv_qty, sum(b.value_incl_vat) as Inv_value from service_providers a left outer join cb b on a.sp_name = b.sp_name and month(inv_date) = 02 and year(inv_date) = 2004 and item is not null group by a.sp_name order by a.sp_name"
'- This query gives me errors
rs.Open SQL3, cn, adOpenForwardOnly, adLockReadOnly, adCmdText
I am able to create an instance of excel. These are the problems i am facing.
Problems:
1. I'm experiencing problems with the third sql statement. - What am I doing wrong?
2. I dont know where or what to say to dump the resulting data into excel
heres the code i have so far:
Code:
If Not rs.EOF Then
Do While Not rs.EOF
For i = 1 To 4
SQL2 = rs.Fields("qty") & "'," & rs.Fields("item") & i
rs2.Open SQL2, cn, adOpenForwardOnly, adLockReadOnly, adCmdText
If Not rs2.EOF Then
'This is what I want to do - Put column heading for only those months in question
'Make those headings white font and fill the cell colours blue
'Then insert the data value into the necessary columns
'????????????? = rs2.Fields("inv_qty") & rs2.Fields("inv_value")
Else
End If
rs2.Close
Next i
rs.MoveNext
Loop
End If
cn.Close
Set rs = Nothing
Set cn = Nothing
Any help would be highly appreciated
Populate An Html Form From Excel VBA
Hello,
I'm populating an HTML form from excel using VBA. I'm successful when the html form field is a text input box. I've been using code:
Code:
IeApp.Document.forms("MYFORM").MYFIELD.Value = "123"
However, if the html form field is anything else (like a combobox or listbox), this code errors as follows:
Code:
Run-time error 438: Object doesn't support this property or method.
Anyone know how to send a value to an HTML combobox from VBA? Thx!
Populating An Excel Worksheet Embedded In An Access Report With Data
IS IT POSSIBLE TO MANIPULATE DATA INSIDE AN EXCEL WORKSHEET THAT IS EMBEDDED IN AN ACCESS REPORT??? I'm beginning to think not. I've been trying for 2 days with no success.
I inserted worksheets in various ways, but let's say I insert a worksheet by doing the following:
In report design mode --> Insert --> Object... --> Create New --> Microsoft Excel Worksheet.
Now, I have a query. I want to populate the embedded, or linked, excel worksheet with the results of my query.
Access cannot create diagonal column headers which my client REQUIRES, and the "Rotate Text" ActiveX control is not clean enough. So, I am using an Excel worksheet for the formatting only. I would import data into the Excel Worksheet from Excel rather than Access, but unfortunately, since my query is a complex crosstab query with a parameter, I get errors when I try to write the SQL statement in Excel. Therefore, I need to embed the worksheet in my Access Report and populate it with data programatically. So far, all my attempts have failed.
At this point I've removed all the unnecessary complexity and all I have is this:
1 Table with two columns (id, name)
1 Query getting names from the table
1 Report with an embedded Microsoft Excel Worksheet
Can somebody please tell me how to get the names into the worksheet in the report?
Populating An Excel Worksheet Embedded In An Access Report With Data
IS IT POSSIBLE TO MANIPULATE DATA INSIDE AN EXCEL WORKSHEET THAT IS EMBEDDED IN AN ACCESS REPORT??? I'm beginning to think not. I've been trying for 2 days with no success.
I inserted worksheets in various ways, but let's say I insert a worksheet by doing the following:
In report design mode --> Insert --> Object... --> Create New --> Microsoft Excel Worksheet.
Now, I have a query. I want to populate the embedded, or linked, excel worksheet with the results of my query.
Access cannot create diagonal column headers which my client REQUIRES, and the "Rotate Text" ActiveX control is not clean enough. So, I am using an Excel worksheet for the formatting only. I would import data into the Excel Worksheet from Excel rather than Access, but unfortunately, since my query is a complex crosstab query with a parameter, I get errors when I try to write the SQL statement in Excel. Therefore, I need to embed the worksheet in my Access Report and populate it with data programatically. So far, all my attempts have failed.
At this point I've removed all the unnecessary complexity and all I have is this:
1 Table with two columns (id, name)
1 Query getting names from the table
1 Report with an embedded Microsoft Excel Worksheet
Can somebody please tell me how to get the names into the worksheet in the report?
Populate Excel Combo Box With Access Data
I am trying to populate an Excel combo box with data from a table in Access. I am using the following code in the "Open" event of my workbook:
******************************
Private Sub Workbook_Open()
' Set SQL to extract issuer info for combo box.
MySQL = "SELECT ID, Name FROM MyTable ORDER BY Name"
Set MyDb = OpenDatabase("c:MyDataBase.mdb")
Set MySet = MyDb.OpenRecordset(MySQL)
If MySet.RecordCount > 0 Then
MySet.MoveFirst
Worksheets("Sheet1").MyCombo.ColumnCount = 2
i = 0
' Load the combo box.
Do Until MySet.EOF
If Not IsNull(MySet("Name")) Then
Worksheets("Sheet1").MyCombo.Column(0, i) = MySet("ID")
Worksheets("Sheet1").MyCombo.Column(1, i) = MySet("Name")
End If
i = i + 1
Loop
End If
MySet.Close
MyDb.Close
End Sub
******************************
I am getting the following error message:
"Could not set the column property. Invalid property array index."
And the following line of code is highlighted by the debugger:
Worksheets("Sheet1").MyCombo.Column(0, i) = MySet("ID")
The code that obtains the data from the database works just fine. The problem is in populating the combo box.
I tried changing the starting value of i to i=1. That didn't work.
I tried changing the .Column(x,y) value to the following:
MyCombo.Column(1, i)
That didn't work.
WHAT IS CAUSING THE ERROR? PLEASE HELP!
Populate Word Combobox With Excel Data
Previously I used the additem command to populate my combobox in a macro used in Word. I would like to use a spreadsheet instead so that I can make changes without having to change the code. How do I populate a Word Macro Combobox with a range from an excel spreadsheet???
Mattwho?
Should I Use An Object To Populate Form With Data From A DB?
Hi all
I understand the concept of object models.
I've written a shopping cart OM but I'm confused about how I should populate my form with the products which the user adds to their cart.
Here's my OM as it stands (the hyphens represent a child relationship (can't do a tree view )
Order object
- Products (collection class)
- Product object
- Customer object
I don't think it should be part of the Order object?
Should I write a generic Cart object that exposes methods to return the data? and if so, how should I return it? - as a collection of Product Objects or should I encapsulate the products and simply make the object into a Data Source Class.
These are pretty advanced topics (to me at least) so please be as simplistic with your answers as I have been with the question
Cheers
Wayne
Populate Internet Explorer Forms With Excel Data
Edit by Moderator:
Please create your own thread and add a link to the original.
Re: http://www.xtremevbtalk.com/showthread.php?t=123340
Edit by Moderator:
Please use [vb][/vb] vb tags.
Hi, I've been reding your posts here and have encountered some problems with this issue myself.
I want to extract the last table in a page, I need the code to count the number of tables in the page and then take out the table text into a text file.
The code I use:
Code:
Sub NextPage(mypage) :huh:
Set fs = CreateObject("Scripting.FileSystemObject")
Set myTXTFile = fs.CreateTextFile("c:mytext.txt", True)
mypage = mypage
Dim IE As Object
Dim testarray(10)
Dim ObjElement As HTMLObjectElement
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate mypage
IE.Visible = True
While IE.Busy
DoEvents 'wait until IE is done loading page.
Wend
For Each element In IE.Document.all
i = i + 1
If element.tagName = "TABLE" Then
j = i
End If
Next
Set tbl = IE.Document.tables(j)
If tbl.innerText <> "" Then
myTXTFile.WriteLine (tbl.innerText)
End If
myTXTFile.Close
IE.Quit
End Sub
The end of the code is worng that I know, don't know how to extract the last table in a page.
Thank you!!
Populate Internet Explorer Forms With Excel Data
hi everyone,
I have done some vba programming. But now, I want to write a vba code, whereby, when the excel spreadsheet is opened, the data from the sheet is taken and it populates the form in an internet explorer browser.
So I need to access the browser objects through the vba code. for example, if there is a textfield named "txt1" in a form in a browser, then that textfield should get the values of a particular cell from an excel spreadsheet. The required page in the browser is already opened before the code for populating the textfield is executed.
I hope this info is enough for you to help me get started. Thanks,
lilpro
How To Pass Selected Combo Box List Data To Populate On A Textbox Form
I need help to populate data from a combo box connected to an access database. form1 has the combox1 with a list of data connected to database1. form2 needs text boxes fields populated from the data selected on form1.
Private Sub cmdOk_Click()
dim strsql as string
strsql = "select field1, field2 from table1 where field1 = " & "'" & CBO1.ListIndex & "'"
form2.textbox1.text = ado1.fields("Field1")
form2.textbox2.text = ado1.fields("Field2")
form2.ado1.refresh
form2.show
Fill A Vba Form With Excel Workbook Data, Updating This Wrkbook W/ Data From The Form
Okay I have a basic to intermediate understanding on using vba and Excel utilities. I need help with the workflow of my application rather than specific procedures.
I've got data on only one worksheet where each record is defined by an account id. Every cell on each record is populating a specific textbox on a form. The form is a basic interface for users, moving from one record to next. So mostly the data will flow from the worksheet to the form with the exception of one field for each record. The user will update that field as needed on the form. There are only 30 records or so on the worksheet. I can't rationalize learning Access and/or some database connection since there are only a few records and few fields.
This is an example of the field headers and one record:
Account Id, Account Name, Total Balance, Past Due Balance, Status
011,ChevyChaseAccount,$1200,$100,Customer sent in check (not posted).
I can think of only one way to update the form with the data and that is piece by piece:
Code:
Private Sub UserForm_Initialize()
With frmDetail
'.txtAccountName = ActiveSheet.ActiveCell.Offset(0, 2).Value (this gives me an error since I can't use the offset property for the code in forms)
.txtAccountName = ActiveSheet.Range("B2").Value (since I can't use offset then I have to resort in a specific address)
.txtAccountId = ActiveSheet.Range("C2").Value (since I can't use offset then I have to resort in a specific address)
.txtTotalBalance = ActiveSheet.Range("D2").Value (since I can't use offset then I have to resort in a specific address)
End With
End Sub
I haven't thought of a way to move from one record to another let alone how to update that one field to another.
Let me know if you have any questions,
Thanks,
Aaron
Transfering Data Form A Data Grid To Excel
Hi guys.
I have a program in VB6 which load data from an access table into a data grid, now I need to trasfer that data in the grid to an excel sheet. How can I do this?.
Thanks in advance
Fill A Vba Form With Excel Workbook Data, Updating The Same Workbook W/ Data From The Form
Okay I have a basic to intermediate understanding on using vba and Excel utilities. I need help with the workflow of my application rather than specific procedures.
I've got data on only one worksheet where each record is defined by an account id. Every cell on each record is populating a specific textbox on a form. The form is a basic interface for users, moving from one record to next. So mostly the data will flow from the worksheet to the form with the exception of one field for each record. The user will update that field as needed on the form. There are only 30 records or so on the worksheet. I can't rationalize learning Access and/or some database connection since there are only a few records and few fields.
This is an example of the field headers and one record:
Account Id, Account Name, Total Balance, Past Due Balance, Status
011,ChevyChaseAccount,$1200,$100,Customer sent in check (not posted).
I can think of only one way to update the form with the data and that is piece by piece:
Code:Private Sub UserForm_Initialize()
With frmDetail
'.txtAccountName = ActiveSheet.ActiveCell.Offset(0, 2).Value (this gives me an error since I can't use the offset property for the code in forms)
.txtAccountName = ActiveSheet.Range("B2").Value (since I can't use offset then I have to resort in a specific address)
.txtAccountId = ActiveSheet.Range("C2").Value (since I can't use offset then I have to resort in a specific address)
.txtTotalBalance = ActiveSheet.Range("D2").Value (since I can't use offset then I have to resort in a specific address)
End With
End Sub
I haven't thought of a way to move from one record to another let alone how to update that one field to another.
Let me know if you have any questions,
Excel Embedded In OLE Box
Hi,
I have an OLE box and a save button on my VB form with the following code
Code:
Option Explicit
Const OLE_CreateEmbed As Long = 0
Const OLE_Activate As Long = 7
Const OLE_Close As Long = 9
Dim WithEvents LGRExcel As Excel.Workbook
Dim shtLGR As Excel.Worksheet
Private Sub cmdSave_Click()
Dim FileNum As Integer
'get file number
FileNum = FreeFile
'Open the file to be saved
Open "C:WebLOLERLGR.xls" For Binary As #FileNum
'Save the file
oleExcel.SaveToFile FileNum
'Close the file
Close #FileNum
'oleExcel.SaveToFile "C:WebLOLERLGR.xls"
End Sub
Private Sub LGRExcel_SheetChange(ByVal Sh As Object, _
ByVal Target As Excel.Range)
If Val(Right(Target.Address, 1)) < 3 Then
'do nothing
Else
MsgBox "Changed Range = " & Target.Address & vbCr & vbCr & _
"New Value = " & Target.Text
End If
End Sub
Private Sub oleExcel_GotFocus()
oleExcel.Enabled = True
oleExcel.SourceDoc = "C:WebLOLERLGR.xls"
oleExcel.Action = 0
With oleExcel.object
.ActiveSheet.Range("A2").Value = "Item Description"
.ActiveSheet.Range("B2").Value = "Detailed Description"
.ActiveSheet.Range("C2").Value = "Item Code"
.ActiveSheet.Range("D2").Value = "SWL"
.ActiveSheet.Range("E2").Value = "Serial No."
.ActiveSheet.Range("F2").Value = "Model"
.ActiveSheet.Range("G2").Value = "Plant ID"
.ActiveSheet.Range("H1").Value = "Details of Manufacture"
' shtLGR.Range("H2").Value = "Name"
' shtLGR.Range("I2").Value = "Certificate No."
' shtLGR.Range("J2").Value = "Date"
' shtLGR.Range("K1").Value = "If Load Tested"
' shtLGR.Range("K2").Value = "Proof Load"
' shtLGR.Range("L2").Value = "Load Test Certificate No"
' shtLGR.Range("M2").Value = "Status"
' With shtLGR.Shapes
'
' .AddLine(0,0,74,74)
'
End With
End Sub
If I type something in the embedded excel sheet and press the save button, it saves the file as Excel file. When I try to open the Excel file there is an error message "This file is not in a recognizable format" and if I press "OK" button in the message it shows the file with lots of characters which are not typed.
In my references "Microsoft Excel 11.0 Object Library" is ticked. I am working on Windows XP professional with MS-Office 2003
What is the problem. Can anyone please help
Regards
Varrey
Embedded VB And Excel. Help Me Please
I need to find out how to create an pocket excel spreadsheet using embedded VB 3.0 on a pocketpc. Could someone help me out or at least point me in the right direction? thanks
Vb With Embedded Excel
I have an application with an embedded Excel spreadsheet. This works fine except when the user already has Excel running. When the VB app runs, my users cannot return to their original spreadsheets on their desktop until they click outside of the OLE container. Is there a way to launch a second instance of Excel so that my users can move painlessly between the two applications?
Combobox On Access Form To Populate Form With Record
Hello code masters
I have a database using Access 2k and some VBA. I want to use a combobox to go to a record and populate my form with that record. Currently I have another form I can go to from this one that has a listbox that will allow me to do the operation I just described. But I can’t seem to duplicate it from the main page. I guess that is a separate issue for now I would like to get the combobox working. This code works in another program I have.
Some names I’m using
frmContacts
tblContacts
So far I have…
Code:
Option Compare Database
Private Sub cboFirst_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[ID] = " & Me![cboFirst]
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub
Private Sub cboFirst_Enter()
cboFirst.BackColor = 16777215 ' Change background to white.
End Sub
Private Sub cboFirst_Exit(Cancel As Integer)
cboFirst.BackColor = 12632256 ' Change background to gray.
End Sub
Private Sub ShowRecord_Click()
' find selected record
With Forms!frmContacts
.RecordsetClone.FindFirst "ID = " & lstFirst
.Bookmark = .RecordsetClone.Bookmark
End With
' close dialog box
DoCmd.Close acForm, Me.Name
End Sub
this is what I have in the combobox properties – Row source - SELECT DISTINCTROW [tblcontacts].[ID], [LastName] & ", " & [FirstName] AS Expr1 FROM tblcontacts;
I click on the combobox and nothing happens.
Hal
Embedded Word In Excel
Hi i have and embedded word document in excel sheet. When i use "open" verb
on embedded document in excel,it will open this document for editing in
microsoft word.
Is there any posibility to detect in word vba that this is embedded document
in excel sheet?
Tnx,Milos Vukov
Office 2k -> 2k3
Vb6,sp6
-------------------------------------------
Make word speak to you!
-------------------------------------------
Flexgrid And Embedded Excel
Hi guys, I'm having a little problem in my project: I have an mshflexgrid in a form that loads datas at runtime, based on a user selection. Once the datas are loaded the user presses a button and the informations fill in an embedded excel sheet on another tab.
Now, I can't get it to fill the information in the appropriate spaces of the excel sheet.
The code should basically:
-run through the second column of the flexgrid, take the first or the last row and transfer the information to the sheet;
-move to the next or previous cell in the same column (of the flexgrid) and compare: if the text is the same, fill the same column in the sheet, else move to another column.
-loop until there are no more rows in the flexgrid column.
The problem right noe is that it runs through the column, but fills always the first column of the excel sheet. In other words I'm missing the second step ('cause I don't really know how to do it....)
Here's the code
Code:
Dim MSH As MSHFlexGrid
Dim strEvent As String
Dim s As Integer
Set MSH = Me.MSHFlexGrid3
With Me.Spreadsheet1
For s = 1 To MSH.Rowsel
strEvent = MSH.TextMatrix(s, 2)
.Cells(6, 2) = strEvent
Select Case MSH.TextMatrix(s, 6)
Case "Saturday"
.Cells(10, 2) = MSH.TextMatrix(s, 7)
.Cells(10, 3) = MSH.TextMatrix(s, 8)
Case "Sunday"
.Cells(11, 2) = MSH.TextMatrix(s, 7)
.Cells(11, 3) = MSH.TextMatrix(s, 8)
Case "Monday"
.Cells(12, 2) = MSH.TextMatrix(s, 7)
.Cells(12, 3) = MSH.TextMatrix(s, 8)
Case "Tuesday"
.Cells(13, 2) = MSH.TextMatrix(s, 7)
.Cells(13, 3) = MSH.TextMatrix(s, 8)
Case "Wednesday"
.Cells(14, 2) = MSH.TextMatrix(s, 7)
.Cells(14, 3) = MSH.TextMatrix(s, 8)
Case "Thursday"
.Cells(15, 2) = MSH.TextMatrix(s, 7)
.Cells(15, 3) = MSH.TextMatrix(s, 8)
Case "Friday"
.Cells(16, 2) = MSH.TextMatrix(s, 7)
.Cells(16, 3) = MSH.TextMatrix(s, 8)
End Select
Next
End With
Embedded Objects In Excel
Hi All,
I wish to search all occurences of the word "Thomas" and replace them with "XXX" in all worksheets of an excel file. I have been successful in writing the code for this.
However, I have noticed that my excel workbook may have numerous embedded word documents where the word "Thomas" may occur.
Please can someone help me write the code which can go into these embedded word documents and do the search/replace.
Any useful leads will also be appreciated.
thanks,
thevbgirl
Embedded Excel Sheet In Vb
Hi,
I need the user to be able to edit a spreadsheet without all the excel menu commands at the top. I figured the best way to do this was to embed the required sheet into a form. However, when I do this, vb seems to resize the ole container based on the size of the first sheet in the workbook. Unfortunately, the first sheet is empty and the sheet I need edited is the third one. This causes the ole container to be very small in size.
Is there anyway to get around this?
Thanks
rob
Embedded Excel Window
I have an OLE window in a form. I have opened a CSV file in the window , which opens an Excel Sheet in my OLE window. The problem is the Excel window is longer and wider than my defined OLE window. I would like to make the Excel window fill the OLE window without going over. How can I do this?
I created the excel window like this:
ole1.CreateEmbed spath, "Excel.Sheet"
How can I set this up?
Embedded Objects In Excel
Hi All,
I wish to search all occurences of the word "David" and replace them with "XXX" in all worksheets of an excel file. I have been successful in writing the code for this.
However, I have noticed that my excel workbook may have numerous embedded word documents where the word "David" may occur.
Please can someone help me write the code which can go into these embedded word documents and do the search/replace.
Any useful leads will also be appreciated.
thanks,
Lonely
Embedded Objects In Excel
Hi,
I think that this is a simple problem!!!
I am using Excel97 under Windows98
I have inserted a Spinner in a Worksheet (embedded control from Forms tool bar) and I now need to get at it. I have tried many times but each time the "set" fails.
Dim spcon as SpinButton ' this line usually Ok
Set spcon = ????????? ' This line fails (the button name is Spinner2)
Worksheet name is Dimensions
What is the syntax of the Set statement ???
Any help much appreciated
Erics
OLE VB Embedded Excel Chart
Hi everyone,
I am using a OLE Embedded Excel Chart in A VB form. I am using it as a ScatterXY plot. I am able to set the axis and data in the associated sheet1 at design time but I don't know how to change data in the associated sheet1 for the graph at run time.
Nothing seems to work. Any help would be greatly appreciated.
Thank You.
Charles
Embedded Data
Hey Guys,
I need to associate calibration data with a .bmp (or .jpg) file.
I know I can create a txt file that can hold the associated cal data,
and have the .bmp file (as 2 seperate entities), however, can I
merge (embed) the cal data into the .bmp file?
I'm guessing a resource file?
If so, I'm after some psuedo code to get me going
The cal data is anly 4 Single data types.
Cheers,
Bruce.
Macros In An Excel Doc. Embedded In A Word Doc.
Hi,
I have a problem regarding macros in embedded documents.
I have an Excel worksheet that contains a macro. I also set a button to run that macro when it's cliqued.
When I insert the Excel worksheet into Word (97 by the way), with the options { link NO, icon YES }, my button doesn't work anymore...
I mean, when I open the document, I choose "Yes, activate the macros". Then Excel is run, and the workbook is named "Feuille de calcul dans C: WINNT Profiles XYZ Bureau Planning.doc" (yeah right, it's a french version ).
The button is still linked to the macro, but it won't do anything.
Still, when I open the VBA Editor, I can run the macro by clicking on the Run button.
Is there something with embedding that disables buttons ?
Weel, any idea is welcome, I'm completely stuck
Thank you
~bigquick~
Update An Embedded Excel Sheet
hi, how can i update an embedded excel worksheet data in microsoft word? I'm using userform to obtain the user input. For example, i write down "How are you?" within the textbox and press the "ok" button, the value of that textbox should be printed on the embeded excel worksheet (for example at range A1). How can i do that? please help me.
Embedded WebBrowser Text To Excel
I have embedded a WebBrowser control on my Excel worksheet, and it works great. Now I don't have to flip between Excel and IE while I am surfing through data bases.
What I would like to do now is make Excel automatically copy the contents of the current web page to Excel as soon as the page loads. I made it work beautifully on one of the company databases, and everyone thought it was slick. It was simple to use webbrowser1.document.documentelement.innerhtml to get everything from the page, and then strip html tags while parsing for the data text and the color of the text (color of text is important).
Now they want me to do it for another database, but this DB web page has two frames. One is a navigation frame, while the other is the data frame. I don't care about the navigation frame, but I don't know how to access the html from the data frame. If I use the same method as above, I get just the navigation frame and not the all important data frame.
Does anyone know how I can get the HTML from the data frame? The name of the data frame changes, but it is always onne of 27 different titles. I have not yet figured out how to get the title of that frame, otherwise it would again be an easy task.
Controlling An Embedded Excel In Word
For the life of me, I can't figure out how to determine the name of an Excel sheet which is embedded in my Word document. Without the name of the spreadsheet, I have no idea how to control it. This should be simple enough but I can't record a macro to provide me with some leads. I've attached the document to this message. Maybe someone can tell me how to control and insert some values in the spreadsheet from a separate VB app.
Thanks! Mike
Working With Embedded Excel In Word
Hello all.
I'm new here but hope to become an active participant.
Here is my first question:
We are working with embedded excel tables in word. (Office 2003) Specifically we have a macro which runs through and converts them over to word tables. While we are doing that, before it converts over, I would like to run a search and replace.
What is the syntax for doing this when we are working with Embedded Excel via a word macro?
Thanks all!
About Sharing Excel File Embedded With Vba...
Hi there. I got an excel file for maintaining employee's leave records. What I want is that the file will be saved in one of the five machines which have been connected via an intranet and so all the five employees can have access to the same excel file and have their leave records enquired and maintained. When user opens the file, my vba will prompt the user for a password and if it is proved to be valid, only the records of the user who logs in will be displayed for enquiry and update.
....And the problem is: How do I make the excel file shared for the 5 users, even at the same time?
Please give me some advice and solution.
Cheers.
Embedded Excel Object In VB6 Activation
Ladies & Gents,
I'm sorry to post this because I normally keep trying until I work it out but this is killing me!!!
I'm placing an OLE Microsoft Excel Worksheet into my main form1. I want it to be active all the time so the user doesn't have to pass focus, or double click it, or anything else. I want them to be able to click the cell to be edited and hey presto.
I've read all about in place activation and seen a Microsoft KB article on how to do it in VB .Net but cant find it in VB6.
Can anyone please help me or suggest another way? I dont want to use the object method.
Thanks in advance for any help
SAJ
Tooltip And Embedded Button In Excel
Hello,
I have been looking around for a way to display a tooltip for an embedded commandbutton on an excel worksheet, and have so far had no luck, all i need a a small description of the buttons function to appear when the mouse is over the relevant button
i keep finding nice ballon tooltip stuff ... lol ... but i cant apply it in vba
Extract Embedded Excel File From EML?
Hi,
I need to write a routine to read in an EML file an extract out of it the attached XLS file. The EML file contains the email header info and then the rest of the file contains the binary XLS file.
Does anyone know how to do this?
Thanks!
Extracting Embedded Object Using VBA In Excel
Hi All,
I have some embedded text files and compressed files in my excel spread sheet. I want to save them in a seperate folder as seperate files. How to do that using vba?
I tried using Oleobject it didn't work
Thanks in advance.
Regards,
Subbu S
Accessing An Embedded Excel Sheet
Hi all,
Using VB, how do I access an Excel sheet that is embedded in a word document, so that I can can write to the cells in that sheet.
Thanks,
Stuart.
I Need Some Serious Help With OLE Container And Embedded Excel Sheet
Situation:
A form (frmTicketInfo) with a OLE container (OLETicketInfo). Container contains an embedded Excel File (TemplateTicketInfo.xls).
When a user pushes a button on the form a recordset is created with data from a database. This data is being displayed on the embedded excel file.
Problem:
It displays 5 lines (which is the default amount of records). But when I want to display more then 5 lines, it doesnt show on the embedded Excel sheet. However it has been put on the embedded file, it's just not being displayed. I tried using the refresh and update methods voor the OLE container, but that doesnt work.
I have to manually enlarge the template file using Excel. The embedded sheet shows as much rows as you have formatted in Excel.
Solution:
I dont have one... Can anyone help me?? Any suggestions on how to edit the embedded excel sheet in the OLE Container. Especially formatting the cells and updating when new data is inserted.
Excel Worksheet Embedded In Word
I use the following code to create an Excel worksheet embedded in my Word
doc:
Code:Dim shp as Shape
Set shp = ActiveDocument.Shapes.AddOLEObject(Anchor:=Selection.Range,ClassType _
:= "Excel.Sheet.8", FileName:="", LinkToFile:=False,DisplayAsIcon:=False)
Using more code, I can manipulate the contents of this worksheet.
BUT, I cannot work out how to control the size of the worksheet so that I
can see more of it. All properties that refer to height or width simply
enlarge the visible contents so that I see the same amount of the worksheet
but it's bigger.
How can I enlarge the rectangle that contains the embedded object, keeping
the contents the same size so that more of the contents are visible?
This is easy with the mouse - simply drag the borders when the object is
active but I cannot work out how to do this programmatically.
I've tried to turn on macro recording, resize the
rectangle, then turn off recording. What I have recorded is an empty Sub!!
I have tried various ways to record the actions but with no success
Please help me!!!!!!!!!!!!!
Edited by - Adagar on 4/16/2003 12:29:18 PM
Embedded Data Report
Hello,
Im in need of embedding a data report (from the data report designer included in VB) directly onto a form. I need users to be able to select various items and as they select (or via a command button) have the report populate on the form, rather than opening a new window. Is this possible? Ive tried using the OLE control and all it does is display the icon of the data report and I can not get it to actually create.
Any thoughts?
Sazlo
Report Embedded In A Form
I am wondering as to how you can get the report data and embedded it below the form. I mean my form takes some parameter and runs a query to get data from the db and this result should appear beneath the fom. ow is this possible. Any suggestions??
Thanks
Populate Form With Info From Another Form (Access)
I am building a multi-form app where the first form allows a search (Access database) on one of 4 categories (4 different option buttons) AND "search by" one of 2 additional option buttons (description or UPC code). Once these options have been selected, I have an "execute" button that populates and loads an additional form (text boxes). I am having difficulty coding this
last part (populating the second form). Here's what I have so far... Any help would be greatly appreciated. Thanks in advance
Private Sub cmdExecute_Click()
Dim blnFound As Boolean
Dim strUPCToUpdate As String
Dim strUPCToModify As String
Dim strSQL As String
Dim intTemp As Integer
Dim rsUpdate As ADODB.Recordset
Set rsUpdate = New ADODB.Recordset
If cboSelection.ListIndex = -1 Then
gstrMessage = "Please select a product first!"
gstrTitle = "Product missing ..."
gintStyle = vbOKOnly + vbExclamation
gintAnswer = MsgBox(gstrMessage, gintStyle, gstrTitle)
Exit Sub
End If
strUPCToUpdate = Mid(Tag, 1, 1) & Format(cboSelection.ItemData(cboSelection.ListIndex), "0000")
strSQL = " SELECT tblProducts.fldProductID, tblProducts.fldName, tblCountry.fldCountry, tblProductSubType.fldProductSubType, tblVolume.fldVolume, tblProducts.fldPrice"
strSQL = strSQL & " FROM tblVolume INNER JOIN (tblCountry INNER JOIN (tblProductSubType INNER JOIN tblProducts ON tblProductSubType.fldProductSubTypeID = tblProducts.fldProductSubTypeID) ON tblCountry.fldCountryID = tblProducts.fldCountryID) ON tblVolume.fldVolumeID = tblProducts.fldVolumeID"
With rsUpdate
.ActiveConnection = cnConn
.CursorLocation = adUseClient
.CursorType = adOpenForwardOnly
.Source = strSQL
.Open
Do While Not .EOF
mstrUPC = !fldProductID
mstrName = !fldName
mstrCountry = !fldCountry
mstrType = !fldProductSubType
mstrVolume = !fldVolume
msngPrice = !fldPrice
.MoveNext
Loop
.Close
End With
With frmModifyProducts
.Tag = Tag
.Caption = "Updating Information to Database (Category: " & Tag & ")"
.lblUPCData.Caption = mstrUPC
.txtName.Text = mstrName
.cboCountry.ListIndex = mintCountry
.cboType.ListIndex = mintType
.cboVolume.ListIndex = mintVolume
.txtPrice.Text = Format(msngPrice, "0.00")
If Tag = "Accessories" Then
.cboCountry.Enabled = False
.cboVolume.Enabled = False
End If
.Show vbModal
End With
Set frmModifyProducts = Nothing
End Sub
Manipulating Embedded Excel Worksheets In Access
I'm having some problems populating & manipulating an Excel worksheet embedded in an Access form & wondered if anyone might be able to help.
I've got an Access form 'frmMS' with an embedded worksheet 'objDisplay' that was created by Insert >> Object >> Create New >> Microsoft Excel Worksheet
The code I've got right now is:
Private Sub butAbout_Click()
Dim objXL As Object
Dim X As Integer
Dim Y As Integer
Set objXL = Me!objDisplay.Object
For X = 1 To 60
For Y = 1 To 5
objXL.Worksheets(1).Cells(Y, X).Value = "Q"
Next
Next
Set objXL = Nothing
End Sub
I spent all day reading Office integration articles (this is my first attempt at integration) without finding anything I could use, & the above code is really just something that I hit on with trial & error after a few frustrating hours. I did see a lot about early & late binding, but everything was referring to linked sheets or opening instances of Access.
It seems to work, & lets me work with the sheet, but there are a few problems:
1) It's really, really, really slow. Exponentially slower as the X range increases.
2) Whenever I first switch the form to design view, it tells me the object is locked & any changes will be discarded. I haven't noticed anything being lost, but this scares me.
3) It seems to do all the operations, then update the sheet. I haven't seen any references to manually controlling when the embedded sheet refreshes, but it's kind of necessary for certain parts of the larger program.
4) I don't know why it works, which just bothers me.
If the larger scheme of things matters at all, the basic purpose of this is getting an embedded sheet that can handle certain graphical elements of an Access project. A simple example would be to picture the sheet like one of those scrolling displays at baseball games, where a user could hit a button & the sheet, by changing the background color of certain cells, would create a message, image, etc. I know this is a stupid way to approach it, but it's unfortunately necessary, & it just drives me nuts that I can't figure it out.
Thanks for any help you can give.
Drawing Shapes In Embedded OLE Excel Spreadsheet
For a project that I am doing, I am embedding an Excel spreadsheet into a VB form as an OLE object. In the spreadsheet I would like to draw shapes, among other things. However, whenever I attempt to draw an shape using the .Shape.AddShape() method, I receive the following error: Run-time error '1004': Application-defined or object-defined error. Here is the code that I am using:
With oleDiagram.object.ActiveSheet.Shapes.AddShape(msoShapeRectangle, 1, 1, 400, 24)
.TextFrame.Characters.Text = "Some Name"
.TextFrame.Characters.Font.Name = "Arial"
.TextFrame.Characters.Font.FontStyle = "Bold"
.TextFrame.Characters.Font.Size = 18
.Line.Visible = msoFalse
End With
I have ran this code as a macro in Excel and it runs fine, but when I attempt to use it for the spreadsheet that I have created in the form, I get the error. I can access the spreadsheet by placing text into the cells using the .Cells(1,1).Value = "something" property and can also copy a shape drawn in Excel into my applications OLE Excel sheet, however cannot draw shapes, lines, etc. Any help would be greatly appreaciated. I have been banging my head on this problem for almost a week now. Thanks!
Embedded OLE Excel Chart Object.. DYNAMIC??
Is it possible to make the OLE Excel Chart object dynamic? I chose to make a chart using this object instead of instantiating a Excel.Chart and creating one from scratch. Now I'm concerned that I can't make if I want these to be dynamic then it can't happen.
What I do is use the OLE excel chart object and then edit it by filling in the excel spreadsheet with the data and then graphing and only displaying the graph as a sheet.
Hopefully someone can help me with this. I'm sure there are VB/OLE Excel guru's out there.
Thanks!
Essa
|