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
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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
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
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
Using Excel Chart Event Procedures When Embedded In PowerPoint
Hi,
Say I've declared a procedure in Excel, with a chart on a seperate sheet, that msgboxes what the value of the series is when you mouseover it, something like this:
>>
Private Sub Chart_MouseMove(ByVal Button As Long, _
ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)
Dim IDNum As Long
Dim a As Long
Dim b As Long
ActiveChart.GetChartElement X, Y, IDNum, a, b
msgbox IDNum
end sub
>>>.
If I paste this chart into Powerpoint I have not found an easy way to access this prcoedure. I know you can set ActionSettings and I suppose you could call another sub that is given a reference to the shape.oleformat.object, but this seems far too hard.
Any thoughts?
Thanks alot,
Greg
How To Copy A Chart From One OLE Excel Sheet To An OLE Excel Chart Object
Hi all,
Kinda stuck here and I have been searching for the way to do this all day. I have a spreadsheet with Charts in one VB OLE container (Excel.Sheet.8)and I want to copy one of the charts to another VB OLE container (Excel.Chart.8) and have it sized to fit in my OLE container. I cant seem to get it to work. Any help?
Where OLE1 = spreadsheets with charts
and OLE2 is a chart
Code:
OLE1.Class = "Excel.Sheet.8"
OLE1.SourceDoc = App.Path & "Data5.xlt"
OLE1.Action = 0
'... Work with the spreadsheet...
OLE2.Class = "Excel.Chart.8"
OLE2.Action = 0
Set OLE2.object = OLE1.object.Charts(1) 'Doesnt Work
OLE2.object.Height = 5000 'Doesnt Work
OLE2.object.Width = 10000
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
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
Embedded Chart In A Worksheet And A Chart Exisiting On Its Own Sheet
what is the difference between a Chart embedded in a worksheet and a chart existing on their own sheets. i mean what is the difference between being embedded in a worksheet and existing on their own sheets.
i came across the statement on the MSDN site
Note Charts embedded in a worksheet are members of the ChartObjects collection, whereas charts that exist on their own sheets belong to the Charts collection.
Creating A Dynamic Chart From A User Form In Excel (Just A Start Please)
Hi Guys I have to do this
Task 2: Spreadsheet
Keerside Primary school has a weather recording project that is undertaken by the infant classes. At noon each day pupils record the rainfall for the last 24 hours and the temperature at noon. These two figures are entered into a spreadsheet and used to produce a graph showing both rainfall (as a bar chart) and temperature (as a line graph) for the calendar month. The spreadsheet also calculates the average rainfall and temperature for the month so far.
Because the spreadsheet is to be used by infant children the school want an interface that is simple to use and does not require the pupils to enter data directly into the spreadsheet. Your task is to create a user form in VBA which is automatically displayed when the spreadsheet is opened and which allows the pupils to select the month and date in the month from combo boxes and to enter the rainfall and temperature into text boxes. Once this is done the pupils can select a command button to transfer the data into the correct worksheet (there should be one for each month) and then display the sheet showing the weather recordings for the month, the graph and the averages. From the sheet the pupils should be able to quit the spreadsheet using a command button.
For this task you only need to include sheets and write VBA code for January, February and March. You should hand in a copy of your spreadsheet on disk.
Any help would be greatly appreciated
venture
Edited by - venture on 8/31/2003 8:29:35 AM
Saving An Embedded Excel Object From Access OleObject To A File
The following code fragment is my attempt to extract embedded documents from an Access database and save them as seperate files.
I am working in Access 2002, where the code works but it doesn't work in Access 2003 where I get an Excel 1004 Error. Ultimately, I want the file in Access 2000 format so it can be used by 2000-2003 users. When it breaks into Debug mode and I step through line by line it works fine.
Does anyone have any ideas? I've tried several ways of calling the Save As and keep getting the same error?
Open to better ideas, I need to repeat this process for Word and Powerpoint documents as well.
Also does anyone know why Access 2002 - 2003 doesn't let you embed Word documents into a table?
Code:
Private Sub Command0_Click()
'On Error GoTo err_Section
Dim objOLE As Object
Dim rs As Recordset
Dim strSQL As String
Dim strAppName As String
Dim strFilename As String
Dim wkb As Excel.Workbook
strSQL = "SELECT FileObject FROM tblFileObjects"
Set rs = CurrentDb.OpenRecordset(strSQL)
Do While rs.EOF = False
'Identify file type
Me.OLEBound = rs!FileObject
Set objOLE = Me.OLEBound.Object
strAppName = objOLE.Application
MsgBox objOLE.Application
'Filename assigned
strFilename = GetFileName()
If strAppName = "Microsoft Excel" Then
Do While Dir(strFilename & ".xls") <> ""
strFilename = strFilename & "1"
Loop
strFilename = strFilename & ".xls"
Me.OLEBound.Action = acOLEActivate
Set wkb = Me.OLEBound.Object.Application.Workbooks(1)
'wkb.SaveAs strFilename
'Tried this line too - same result
Forms![frmOleform].OLEBound.Object.Application.Workbooks(1).SaveAs "strFilename"
Set wkb = Nothing
Exit Do
End If
'If strAppName = "Powerpoint Presentation" Then
'Similar process for Powerpoint
'If strAppName = "Word Document" Then
'Similar process for Word.
Loop
End Sub
OLE Excel Chart Object
Can someone help me in writing the code for the following results?
All I want to do is display an Excel chart in an OLE container. If I display the chart in an image control the graphics are very distorted. The OLE container displays much better. Here is the code I have for now.
If rs.EOF = True Then
Else
Set xlApp = New Excel.Application
xlApp.Workbooks.Open FileName:=rs("PathFileLocation").Value
Set currentchart = xlApp.ActiveChart
currentchart.CopyPicture xlScreen, xlBitmap, xlScreen
frmReferenceResults.imaRMChart.Picture = Clipboard.GetData
xlApp.DisplayAlerts = False
xlApp.ActiveWorkbook.Close SaveChanges:=False,_FileName:=rs("PathFileLocation").Value
xlApp.Quit
Set xlApp = Nothing
End If
Excel Chart Object In VB
Hi,
In my program I have inserted an Excel chart (by going to Components, insertable objects and selecting excel chart). Anybody know how to update the values in the chart sheet?
Thanks
Excel VBA Guru's (Chart Object)
Hi,
I have a spreadsheet with quite a few charts.....
What I would like to do is change the value for the chart options:
1. X-axis value
2. Name (of the series) value
3. The values for the series themselves
Here is the code that the macro recorder produced (apart from the With's)
Code:
ActiveSheet.ChartObjects("Chart 1").Activate
With ActiveChart
.ChartArea.Select
.SeriesCollection(1).XValues = "=DATA!R14C1:R25C1"
.SeriesCollection(1).Values = "=DATA!R14C4:R25C4"
.SeriesCollection(1).Name = "=DATA!R2C4"
.SeriesCollection(2).XValues = "=DATA!R14C1:R25C1"
.SeriesCollection(2).Values = "=DATA!R14C5:R25C5"
.SeriesCollection(2).Name = "=DATA!R2C5"
end with
This works for the Xvalues but not for values and Name, the error I am receiving is the following
"Unable to set the values property of the series class"
Does anybody know why? or have any idea of other ways of changing the series values.. (The charts aren't embedded, I assume this makes a diffence i.e. whether you can use Chartobject or Charts !!)
I have even used the following
Code:
.seriescollection(1).Name = Worksheets("DATA").Range("A1:A25")
But that didn't work either (Seems to only work if you add a series, not amending an already existing one).... There must be a way to do this !!!! (He says)
Thanks for any help
Steve
Excel Chart Object In VB6 Form
Well, this IS the "Newbie" forum, so here's a newbie question...
I added the "Microsoft Excel Chart" Insertable Object component to my VB6 project and it added that new button to the Toolbox. When I used to button to add a chart object to a form, I got an object "Chart1". Right-clicking this object and selecting Edit reveals an Excel 'workbook' with a default chart on sheet 'Chart1' and the data producing the chart on 'Sheet1'.
This is probably not news to any of you, but my question is, now that this obejct is in my form and I've edited the chart to look like I want it to look, how do I 'talk' to it? In other words, using the VB form's objects and user interaction how can I alter the data in this Excel chart object to update the chart as needed? A hypothetical example... I want a value entered into a text box 'myTextBox' on my VB form to be copied into cell B1 of Sheet1 in the embedded workbook.
Can this be done?
Thank you,
Gary Lofgren
VBA Excel Chart Builder Object
Hello all,
I'm still relatively new to VBA, so this should be a simple FAQ. I've noticed a lack of documentation on building excel charts. I especially noticed the lack of it when my company wanted me to build a vba application that would build charts based on employee performance since charts are a much more effective way of guaging your performance in relation to the company. At first I thought the project would be simple and the hardest part would probably be getting the data. Well, with the kind of data they were giving me, I found out that building the charts would be a virtual nightmare (at least for me). After alot of research (including alot of books I own), I didn't seem to find much to help me, so I started into some good ole fashioned trial and error. Since I would rather not have to reinvent the wheel, I built my results into a class module that I can reuse later on. I believe that in building this class module, I've found an excel chart bug. For some reason, the charts that were built would occassionally add on an extra empty series at the end of a chart. This would happen at random times with the exact same data (I quadrouple checked). So I included some code to debug this. Heres the code for the class module:
Code:
Sub BuildChart(ChartType As XlChartType, xvalues As Variant, chartValues As Variant, seriesName As Variant, chartName As String, Optional chartCaption As String = "", Optional chartLegend As Boolean = True, Optional chartLabels As Boolean = False, Optional AutoPatterns As Boolean = False, Optional color As Boolean = True, Optional LabelFontSize As Integer = 3)
'The prerequisites for building this chart is an Array that contains 2 or more Arrays for the chartValues argument, a single
'dimensional array for xValues. Be careful to make all the arrays either 1 based arrays becuase of the fact that
'this object is working with 1 based collections such as a chart series.
Dim PatternArray(1 To 19) As MsoPatternType
PatternArray(1) = msoPatternZigZag
PatternArray(2) = msoPatternSmallCheckerBoard
PatternArray(3) = msoPatternSolidDiamond
PatternArray(4) = msoPatternSphere
PatternArray(5) = msoPatternWeave
PatternArray(6) = msoPattern30Percent
PatternArray(7) = msoPatternHorizontalBrick
PatternArray(8) = msoPatternDarkDownwardDiagonal
PatternArray(9) = msoPatternPlaid
PatternArray(10) = msoPatternShingle
PatternArray(11) = msoPatternNarrowHorizontal
PatternArray(12) = msoPatternDarkUpwardDiagonal
PatternArray(13) = msoPattern80Percent
PatternArray(14) = msoPatternSmallGrid
PatternArray(15) = msoPatternLargeCheckerBoard
PatternArray(16) = msoPatternTrellis
PatternArray(17) = msoPatternDarkHorizontal
PatternArray(18) = msoPatternDiagonalBrick
PatternArray(19) = msoPatternOutlinedDiamond
Dim myseries As SeriesCollection
Dim mychart As Chart
Dim i As Integer
Set mychart = Charts.Add
If chartName <> "" Then
mychart.Name = chartName
End If
'Set the chart type
mychart.ChartType = ChartType
Set myseries = mychart.SeriesCollection
'Object requires a 2 Dimentional Array that stores the arrays for the values
If UBound(chartValues) = 1 Then
myseries.NewSeries
myseries.Item(1).Name = seriesName(0)
myseries.Item(1).Values = chartValues(0)
Else
For i = LBound(chartValues) To UBound(chartValues)
myseries.NewSeries
myseries.Item(i).Name = seriesName(i)
myseries.Item(i).Values = chartValues(i)
Next
End If
'Compensate for chart bug
If myseries.Count > UBound(chartValues) Then
Do Until myseries.Count = UBound(chartValues)
myseries.Item(myseries.Count).Delete
Loop
End If
mychart.Axes(xlCategory).CategoryNames = xvalues
If chartLabels = True Then
mychart.ApplyDataLabels Type:=xlDataLabelsShowLabels, AutoText:=True, LegendKey:=False, ShowValue:=True
End If
If chartCaption <> "" Then
mychart.HasTitle = True
mychart.chartTitle.Caption = chartCaption
End If
mychart.HasLegend = chartLegend
If AutoPatterns = True Then
For i = 1 To myseries.Count
ActiveChart.SeriesCollection(i).Select
Selection.Fill.Patterned Pattern:=PatternArray(i)
If color = False Then
With Selection
.Fill.Visible = True
.Fill.ForeColor.SchemeColor = 15
.Fill.BackColor.SchemeColor = 2
End With
End If
Next i
End If
'Label Font Size
If chartLabels = True Then
If LabelFontSize > 0 And chartLegend = True Then
For i = 1 To myseries.Count
myseries.Item(i).DataLabels.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = LabelFontSize
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
Next i
End If
End If
'Set the Legend Size
mychart.Legend.Select
With Selection.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 14
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
'Set the width and height
mychart.PlotArea.Select
Selection.Top = 1
Selection.Height = 453
Selection.Left = 1
Selection.Width = 677
End Sub
Here is the code in the module that uses the class module:
Code:
Sub test()
'This code is set up for a black and white printer, but can be changed to color, and solid
'patterns by changing the color argument to True as well as the autopatterns argument
Dim x As New ChartBuilder
Dim overall(1 To 2) As Variant
Dim y(1 To 3) As Integer
Dim z(1 To 3) As Integer
Dim strSeriesNames(1 To 3) As String
Dim intXvalues(1 To 3) As Integer
y(1) = 4
y(2) = 5
y(3) = 6
z(1) = 5
z(2) = 6
z(3) = 7
strSeriesNames(1) = "a"
strSeriesNames(2) = "b"
strSeriesNames(3) = "c"
intXvalues(1) = 1
intXvalues(2) = 2
intXvalues(3) = 3
overall(1) = y()
overall(2) = z()
Call x.BuildChart(xl3DColumn, intXvalues, overall, strSeriesNames, "My Chart", "My Chart Caption", True, True, True, False, 8)
End Sub
This class module works best if you use 1 based arrays since your working with 1 based collections such as the chart series collection. I also had to have the option to print from a black and white printer (cheap mana--- I mean,,, cost effective management ), so I included an argument called autopatterns to automatically pattern the charts, and also an argument to make the chart black and white. There are a few other features which I will not go into detail here. This is my first shot at this, so I welcome any feedback as I'm sure this is anything but perfect.
I've tested this with the following charts with success. There are several charts that will not work with this code. Hope this helps someone!!
xlBarClustered
xl3DBarStacked
xl3DBarStacked100
xl3DColumn
xl3DColumnClustered
xl3DColumnStacked
xlArea
xlAreaStacked
xlAreaStacked100
xlConeClustered
xlConeBarStacked
xlConeBarStacked100
xlConeCol
xlConeClustered
xlConeColStacked
xlConeColStacked100
xlCylinderBarClustered
xlCylinderBarStacked
xlCylinderBarStacked100
xlCylinderCol
xlCylinderColClustered
xlCylinderColStacked
xlCylinderColStacked100
xlDoughnut
xlDoughnutExploded
xlLine
xlLineMarkers
xlLineMarkersStacked
xlLineMarkersStacked100
xlLineStacked
xlLineStacked100
xlPyramidBarClustered
xlPyramidBarStacked
xlPyramidBarStacked100
xlPyramidCol
xlPyramidColClustered
xlPyramidColStacked
xlPyramidColStacked100
xlRadar
xlRadarFilled
xlRadarMarkers
xlXYScatter
xlXYScatterLines
xlXYScatterLinesNoMarkers
xlXYScatterSmooth
xlXYScatterSmothNoMarkers
Object Microsoft Excel Chart
I put object Microsoft Excel Chart in my form and the chart was build with sheet1 situate in the object Chart1 but I will like to change data on sheet1 to make a new chart but I not able.
I try with Worksheet("Sheet1").cells(2, 3).value = new value but I receive all the time this error "Method or data member not found" for Worksheets.
My problem is "am not able to select the sheet in the object(Chart1)"
I will like to take data in DBGrid and put them in Sheet1 to make new chart.
Help me !
Sorry for my english
Thanks
Redg
Object Microsoft Excel Chart .....
I asked 5 times about this question and I'm not resolve my problem. Who can help me?
I put object Microsoft Excel Chart in my form and the chart was build with sheet1 situate in the object Chart1 but I will like to change data on sheet1 to make a new chart but I not able.
I try with Worksheet("Sheet1").cells(2, 3).value = new value but I receive all the time this error "Method or data member not found" for Worksheets.
My problem is "am not able to select the sheet in the object(Chart1)"
I will like to take data in DBGrid and put them in Sheet1 to make new chart.
Help me !
Sorry for my english
Thanks
Redg
Object Microsoft Excel Chart
I puted graph in my form1 "Microsoft Excel Chart" and I would like to change data in graph but I don't know what can I do that.
I try with:
Chart1.Worksheet("sheet1").Select
Chart1.Activesheet.Cells(2, 3).value = 10
or
Chart1.sheet1....
or
Chart1. ??? but not succes because each time I recieved this error "method or data member not found"
In the object I have one graph and one sheet. The graph was make with data in sheet1 and I will like to change data in Sheet1 but how?
Who can help me?
Thanks
Redg
Add A Range To An Excel Chart Object!
Hiya!
I have an excel chart object in vb5 and in the excel sheet I have some columns that I want to be the input for the chart.
Getting the values is easy, just have to use Range command but how do I connect them to the chart object so it uses that specified range for the chart?
Thanks for any help.
Magnus
Problem In Dynamically Using The Excel Chart Object?
hi,
i have an application which is designed to do data anlaysis and display the data in various formats like graphs ,excel reports.
while designing the excel report i have to export the data from visual basic and for that data i have to plot the graph on the chart object by code
for example i have data which i exported to excel.the data is shown below.
FSDevice1Device2Device3Device4Device5
1256.543484.2265416.6438536.5191874.643987
2504.7021574.1724797.2056346.3247515.900553
5005.3084536.1017288.1564877.701377.779077
now iam trying to plot the data using excel chart object...
Set objChart = objSheet.ChartObjects.Add(100, 100, 500, 200)
objChart.Chart.ChartType = xlLine
Set xlseries = objChart.Chart.SeriesCollection
'''''for the y series''''''''''
xlseries.Add Source:=objBook.Sheets(strName).range("B2:B4")
xlseries.Add Source:=objBook.Sheets(strName).range("C2:C4")
xlseries.Add Source:=objBook.Sheets(strName).range("D24")
xlseries.Add Source:=objBook.Sheets(strName).range("E2:E4")
xlseries.Add Source:=objBook.Sheets(strName).range("F2:F4")
'''''for the X series''''''''''
For i = 1 To xlseries.Count
xlseries.Item(i).XValues =ObjBook.Sheets(strName).range("A2:A4")
xlseries.Item(i).Name = "D" & i
Next i
but the problem is the data is dynamic.so iam when iam trying to pass the values in the form of range the application is giving error like "Application Error or User Defined Error".
and i donot know the exact range of cells ie from where the cell starts and where the cell ends and how many cells are there.
bcos the data is dynamic ?????
could any body tell me how to pass dynamically the data into series collection.
regards
varma
Urgent... Object Microsoft Excel Chart
I asked 5 times about this question and I'm not resolve my problem. Who can help me?
I put object Microsoft Excel Chart in my form and the chart was build with sheet1 situate in the object Chart1 but I will like to change data on sheet1 to make a new chart but I not able.
I try with Worksheet("Sheet1").cells(2, 3).value = new value but I receive all the time this error "Method or data member not found" for Worksheets.
My problem is "am not able to select the sheet in the object(Chart1)"
I will like to take data in DBGrid and put them in Sheet1 to make new chart.
Help me !
Sorry for my english
Thanks
Redg
Controlling Position Of A Drawing Object On An Excel Chart
I have a line chart that is an on-going time series chart. Each month I add another data point to the series. I currently have a vertical line drawn on the chart crossing one of the data points representing when an event occurred. I have everything working except how to determine how much (where) to move the line to stay with that month's data point as the points get shifted due to the addition of the new point.
I've looked at all the properties of the Point object hoping to find something like an (x,y) coordinate positioning on the chart (I thought I could use the same x coordinate for my object). But, I can't find anything that seems to work. Does anyone have any ideas to try?
Excel - Chart Object - Category X Axis Labels
I have a chart object generate in VBA as follows:
With ChartObject
'Set up Chart Title
.HasTitle = True
.ChartTitle.Text = ChartTitle
'Set up Source Data
.SetSourceData Source:=SourceData, _
PlotBy:=xlColumns
'Set up Y1 Axis Title
With .Axes(xlValue)
.HasTitle = True
.AxisTitle.Text = YAxisTitle
.MinimumScale = Module1.SetScaleValues(LCL, "Deflate", 20) 'Set Minimum Scale to 20% less than LCL
.MaximumScale = Module1.SetScaleValues(UCL, "Inflate", 20) 'Set Maximum Scale to 20% more than UCL
End With
End With
I am passiing in the variables which contain my sources etc.
What I am unable to get working is to set each value on the x axis to look up the value in my first column in the data range (my index). So when you hover the mouse cursor over a data point - it tells you which index (X value) the point relates to.
If you manually set this in a chart - through the qizard - it automatically sets the x axis category labels as the first column. My code sets all columns as the series. I dont want the first columns as the series at all.
Any help would be much appreciated.
Thanks....
How To Link Excel Chart Object Generated With VB To Access Field
Hello,
Sorry, I am new to VB and Database. I generated an OLE control on my panel, and embeded a Excel Chart into it, which shows my calculated result. And I want to send this Excel chart back to one field of my Access table. How could I realize this?
In Access, we could manually insert object, the using Browse to choose the Excel file, making it linked to the field, which has OLE object as its data type. However, how could I realize the whole set of movement with my VB programming?
Experts, please help.
Display An Excel Chart In An &"insertable Excel Object&"
I am programming in VB6 and I would like to display the contents of an excel chart in my VB application.
I guess I can do it using an "insertable excel object". BUT I can not figure out how it works!!
Is there is another easy way to do it without using these "insertable objects"??
Any help is welcome
Embedded UDT Dynamic Dimensions
Any suggestions on how to structure a UDT of the following requirements:
Subsidiary(unknown #). EmployeeName(unknown #).otherparms
Both the subsidiary and employee must be dynamic not static
consequently the following will not work
Type Subsidiary
EmployeeName(1 to 20) As String
EndType
Dim Subsidiary(10) As SubRec
Thanks
David
Can't Deactivate Ole Chart Embedded In Word
All,
I can insert and manipulate an Excel Chart in word using the following code:
wd.Selection.InlineShapes.AddOLEObject ClassType:="Excel.Chart.8", FileName:= _
"", LinkToFile:=False, DisplayAsIcon:=False
numPlots = wd.ActiveDocument.InlineShapes.count
With wd.ActiveDocument.InlineShapes(numPlots).OLEFormat
'.Activate
Set objC = .object
End With
However, when I'm done doing stuff to the Excel Chart, I can't seem to write code to deactivate the ole object. It just stays activated (e.g. displayed as a workbook with a chart sheet and a worksheet). I can actually do stuff in Work programmatically while the Excel Chart is activated, but I wish to close/deactivate the chart so that the users sees only the ole chart.
Any help would be appreciated. Thanx!
Defining FONT In Legend Of Embedded Chart
Hi, I've got a macro which generates 4 charts embedded in a worksheet and publishes them as web pages. Problem I have now is that the legend FONT is too big and for the (24) lines of the bar chart not all items show. I'd like to be able to define both the FONT and FONT SIZE to be used within the legend so I can fiddle it to fit. Anyone able to help?
Thanks, Tom
Embedded Chart Selected - Workbook Deactivate Event Not Triggered In VBA
It seems that if you have an embedded chart selected on a worksheet that the Workbook_Deactivate() event is not triggered.
Originally I thought this behavior was a coding error, so I set up a simple sheet with 1 chart on it and the Workbook_Deactivate() and Workbook_Activate() events with a Msgbox command in both events to indicate when I enter them. Turns out that if the chart is selected, the Workbook_Deactivate() event doesn't trigger when switching workbooks, but the Workbook_Activate() event does trigger when coming back in. When the chart is not selected, both trigger. This is really non-intuitive to me as you can't set a chart event on an embedded chart without creating an event class (as far as I know).
I did create an event class just to check it out and it works (myChartClass_Deactivate()). However, that means I would need to set every embedded chart in my workbook to the class??? and also set a Workbook_SheetActivate event to catch for when I just deselect a chart and do not leave the workbook ("If ActiveWorkbook.Name <> ThisWorkbook.Name Then ..." works as I only care about the chart deactivate event to indicate that I left the workbook).
This can't be correct. Am I missing something here or is that what you really need to do?
thx in advance
OLE Embedded Object/Object Packager Automation
I would like to mimic the action of double-clicking on an OLE Embedded object and opening it in the designated window. Thus when a slide show contains a slide with the object I would like to programmatically open the contents of the container. What I would like is advice as to how this can be done. With a Presentation with one slide and one OLE Embedded object, I have tried the following:
On a button event I call the following lines:
Code:
ActivePresentation.Slides(1).Shapes(1).Select
ActivePresentation.Slides(1).Shapes(1).OLEFormat.D oVerb 1
But I receive the error message:
Shape (unknown member): Invalid request. The window must be in slide or notes view.
I have also tried surrounding the above code with:
Code:
lOriginalView = ActiveWindow.ViewType
ActiveWindow.ViewType = ppViewSlide
' Do stuff.
ActiveWindow.ViewType = lOriginalView
But I receive the error:
Application (unknown member): Invalid request. There is no currently
active document window.
I have also looked into using SendKeys, ShellExecute and ActivateShape, as well as a third party control that exposes a slide’s events.
Create Chart In Access Using Chart Object
Code:
Dim rpt As Access.Report
Dim ctlObjFrame As Access.ObjectFrame
Dim SQL As String
Dim cw_rs As DAO.Recordset
SQL = "SELECT (Format([Date1],'DDDDD')),Sum([Events]) AS [SumOfEvents] FROM [Data] GROUP BY (Int([Date1])),(Format([Date1],'DDDDD'))"
Set rpt = CreateReport
Set ctlObjFrame = CreateReportControl(rpt.Name, acObjectFrame, , "", "", 100, 100)
Set cw_rs = CodeDb.OpenRecordset(SQL, dbopendynaset)
cw_rs.MoveFirst
ctlObjFrame.OleData= cw_rs!ChartObject
DoCmd.Restore
I got the above code from a site. It creates a new report & an objectFrame. But during run-time it gives error in "ctlObjFrame.OleData" as "Items not found in the collections" error. Can anyone please tell me why i get this error.
Dynamic Chart Creation
Ive been working for the past while on a VBA application which has as its main function the creation of graphs to compare prices charged by various companies for various products.
Im looking to make the application dynamic to future changes, explicitly, [1] to cope with changes in prices charged by existing corporations and [2] to be able to add new companies to the graphs if they enter the market.
I basically have laid out the data in one worksheet, Recorded macros as appropriate to create various graphs and then assigned them to buttons on a form.
Im running into problems implementing the second aim above, adding new companies to the graphs.
Im just a beginner to vb so my initial thoughts were to record the macros including rows which were empty and which could be filled if and when a competitor entered. However, this strategy makes the graphs created now look lobsided with null histogram slots etc.
Is it possible to write code which will insert a row into a spreadsheet while still allowing the original macro to capture all the data or would a new macro have to be recorded?
Apologies for the rambling post
Dynamic Chart In Access ?
Hi all, I m wondering if it is possible to dynamically generate a chart in a report, using some criteria-s selected on a form.
Basically i have a couple of tables with the following information.
Table1
Employee Department1
Employee Department2
....
...
...
Table2
Employee Skill1
Employee Skill2
..
..
..
Table3
Employee Location1
...
...
This informatino will be displayed on a form, which the user can choose one or more of . Then based on the selection, I will have to query for the correct department, skill, location... then generate a access chart to graphically represent this. Is this possible ? Im' still new to Access, so any input will be appreciated. Thank you.
Embedded Object
hi expert.. How can i embedded an excel spreadsheet in word document?
-----------
|
|
|word ==> Textbox value
-----------
(Enter)
When i press enter button the textbox value will be inserted within the excel spreadsheet cells. How can i do that? also how can i do that repeately like this..
if button is clicked for the 1st time the value will be inserted in range A1
if button is clicked for the 2nd time the value will be inserted in range A2
if button is clicked for the 3rd time the value will be inserted in range A3
if button is clicked for the 4th time the value will be inserted in range A4
and so on..
please help me.. thank you
MSChart - Dynamic Display Of Data In Bar Chart
Hi,
Can anyone please help me with mschart. The requirement is to display temperature values which increases every few milliseconds in the form of a bar chart.
I need a method to display the bar chart column gradually increase every few milliseconds to show the temperature fluctuations.
I have currently used a timer and an array of temperature values for achieving this functionality but the vb form is flickering. Please help as this is urgent!!
Thanks
Create Chart Using Dynamic Range (Q146055)
I am attempting to use Q146055 to build chart using a macro. I have included sample data and code below. I added Dim statement for myrange and mysheetname. I am getting the following error
Runtime error '1004'
Method 'Range of object' _Global failed
Debug jumps to Range ("c4").Select
I am using Microsoft Excel 2002 (10.4302.4219) SP-2 and
Microsoft VB 6.3
I have tried to generate code for building chart by recording macro, but have been unable to incorporate into subroutine below to get it to work.
,Region 1,Region 2,Region 3
Jan,10,80,15
Feb,20,70,25
Mar,30,60,35
Apr,40,50,45
Option Explicit
Sub Createchart()
Dim myrange, mysheetname As Variant
' Select the cell in the upper-left corner of the chart.
Range("c4").Select
' Select the current range of data. This line of code assumes that
' the current region of cells is contiguous - without empty rows
' or columns
Selection.CurrentRegion.Select
' Assign the address of the selected range of cells to a variable
myrange = Selection.Address
' Assign the name of the active sheet to a variable is
' used in order to allow a chart to be created on a separate chart
' sheet.
mysheetname = ActiveSheet.Name
' Add a chart to the active sheet.
' ActiveSheet.chartObjects.Add(125.25, 60, 301.5, 155.25).Select
'To create a chart on a separate chart sheet, remark out the
'previous line, and substitute the next line for te one above
'Charts.Add
Application.CutCopyMode = False
'This line can best be written by recording a macro, and
'modifying the code generated by the Microsoft Excel Macro
'recorder.
ActiveChart.ChartWizard _
Source:=Sheets(mysheetname).Range(myrange), _
Gallery:=xlLine, Format:=4, PlotBy:xlRows, _
Categorylabels:=1, SeriesLabels:=1, HasLegend:=1, _
Title:="", CategoryTitle:="", _
Valuetitle:="",, ExtraTitle:=""
End Sub
Xls-Object Embedded In Doc-Document
Hi guys,
I have a big problem and no clue what I should do know - hope you can help me. I crearted a VBA code in a xls-sheet, which activates a word- document and in this word- document it activates an xls-OLE-Object. Activating and insert data in the Object is no problem, but how can I deactivate the OLE-Object.
Until now the code looks something like that:
pfad = "C:..."
Set wdObj = getObject(pfad)
wdObj.InlineShape(1).Activate
....
I look for something like "wdObj.InlineShape(1).Activate"
Saving An Embedded Object
I am embedding a software on an OLE control to get its graphical functionality available to me.
How do i save the changes i made on the OLE control to the source file used in the CreateEmbed method ?
For example, think you put Visio on a OLE control. Make a visio diagram. How do you save it ?
I might be doing something wrong with updating the source document cause it seems as if the source document and the drawing i made have no connection.
Thanks in advance,
Ilan.
How To Refer To Embedded OLE Object?
I have embedded a picture file in an OLE object. How do i refe to it? i.e. if I want to delete the picture while refreshing th page or if i want to perform some action using the IF claus depending on the picture embedded or if i want to save th picture using file system object etc. then how do i do it?
rite now i am using CreateEmbed to embed a new picture/object.
and no, i cant use picture control/image control for embeddin pictures since only OLE supports the format of pix i am using.
thanx in advance
Regards,
Prasad
XBase - Embedded Object
I've got an xBase or dBase IV/V .DBF file which I can open programmatically using the data control in VB 4.0. Only problem is that it's not giving me a full list of the fields.
There are two fields called DRAFT_OBJ and LIVE_OBJ which contain Microsoft Word files. Actually, I think, the fields contain links to a .DBT file which contains the actual Microsoft Word data.
My problem is that I can't get at those two fields to get the data. I have the same problem programmatically and in MS Access. Any suggestions?
Bernie
Create Dynamic Horizontal Reference Line On Chart
Afternoon all.
I have a couple questions. First, I am trying to create a horizontal reference line on an existing chart. The reference line should be based on a single cell. I found a somewhat confusing way to do it on the web using named ranges and the following command:
The web stuff I used can be found at: http://www.mrexcel.com/archive/Chart/23671.html
Code:
=Series(,,NamedRange,1)
This "works" fine for a named range defined as a single cell. Changing the cell value changes the location of the reference line (as desired). Unfortunately, the reference line segment is short. I would like it to run from the Y-axis to the opposite side. Can anyone tell me what all the parameters in the "=Series" are? If you know of or can show me a better way to accomplish what I am looking for please let me know. Also, is there anyway I can do this via VBA? Thanks in advance.
Edited by - wein3967 on 4/3/2007 1:18:43 PM
Including Dynamic Chart In Web Page Via Crystal Reports
I'm want to dynamically create a bar chart from Crystal Reports (either 8.5 or 9.0) and save it as an image via an ASP page. Then, I'd like to use that image in the page I'm currently building.
I currently have a COM that is connecting to Crystal to spit-out dynamically created pdf files that I then open via hyperlink.
I'm not using RAS... Nor do I have Enterprise installed on the IIS server.
In short, can I create a unique bar-graph image from a Crystal .rpt file, on demand, from the web?
Anyone who replys within 2 days of me posting this message will recieve 5 EXTRA BROWNIE POINTS!
Thanks,
JT Howard
How To Know What Properties Embedded In An Activex Object
I am always curioused.
For a while I browse this forum, I came accross some threads
regarding activex object such as excel and word objects.
I wonder how you all know all the properties and functions
for that particular object.
Someone told me to get a reference file for the object, but
where I am to get it for Excel and Word?
I know it's Microsoft.com but any specific website for me
to grab a reference about Excel and Word object's properties
and functions?
Desperated, pls.
Thanks.
Unable To Create Embedded Object
Hi,,,
When I try to use a form object with command button in
VBA project inside Microsoft Excel, I get "Unable to create Embedded object" error.
When I use the form object without command button, it loads.
I couldn't get what is wrong and where?
Ganraj
How To Get An Image From An Embedded OLE Object On RichTextBox ?
Hi all.
I have a RichTextBox control in my application which loads an RTF file.
I know that I can get OLEObjects from RichTextBox using its property OLEObjects, so I can get an embedded OLE object from my RichTextBox like this:
Set obj = RichTextBox1.OLEObjects(1)
But, how can I load the embedded image into a PictureBox ? I don't see any property or method from OLEObject for getting that image.
Can anyone help me, please?
Need Help! How To Create A Word Object Embedded In A Form?
Hi there! I know how to create a word object, my project opens Microsoft Word and pastes there, but how could I make it an embedded word object? And something else... When I paste using .selection, my whole page is selected. How do I remove (not delete) the selection?
Thanks in advance!
How To Extracte Embedded File Object In Word.
Hi! HOw Can I extract and Save embedded file in Microsoft Word using Visual Basic.
For exmaple I have a Word File and I insert an Object File as an Icon...
If we open the Word File and I click the Icon.. I will be able to save this file right? This is What I want to do in Visual Basic.
Thanks!
IANIAN
<How Do You?> Make Binary Copy From OLE Embedded Object
I've searched the whole forum for any topics that may be related to my query but found none. So I hope I receive some good feed back from my fellow coders.
What I've attempted to do was create an exact binary copy of an OLE embedded object to a specific folder
(i.e. [OLE-Container with embedded copy of a binary file ex:MyApp.exe] create binary duplicate to C:Temp...)
The code that I've use has no syntax errors but does not produce the desired logical output.
Code:'Home, Appfile are the variables holding the values for path and filename
Code:'fnum is the integer variable for free file number
Code:Open Home & AppFile For Binary As #fnum
Code:'Here I instruct the OLE object to save the embedded object to the free file that is opened for binary
Code:Me.oleSrv.SaveToFile (fnum)
Code:'After closing the freefile and analyzing the produced copy, the file size is about 10+KB smaller than the actual OLE embedded object
Code:Close #fnum
This function does execute. However, it does not create an exact binary copy of the object contained within the OLE control.
The problem is easily noticable since the file size is off by 10+ KB when compared To the object contained inside the OLE control. The function does create a file in the pre-determined folder but it cannot execute
because obviously there are some bytes missing.
The help that I need is how can I make the OLE control act as a true container containing a copy of a file that is not linked, then
copying the contents of the OLE to a new folder location?
If this concept can be achieved then I could create my own packager executable using OLE controls to contain 'data' files for re-distribution.
GRAMMARSoft@root-core.com
Edited by - GRAMMARSoft on 9/6/2002 5:05:02 AM
|