7369.html
来自「VB技巧问答10000例,是一个教程」· HTML 代码 · 共 27 行
HTML
27 行
<html>
<head>
<title>Re: 当然可以</title>
</head>
<body bgcolor="#FFFFFF" vlink="#808080">
<center>
<h1>Re: 当然可以</h1>
</center>
<hr size=7 width=75%>
<hr size=7 width=75%><p>
Posted by <a href="mailto:nospam@nospm.com">David Wong</a> on November 16, 1998 at 09:02:20:<p>
In Reply to: <a href="7347.html">VBA 可以直接被 VB 传叫及应用吗?</a> posted by VBA 新手 on November 14, 1998 at 17:34:25:<p>
你可以看 Que 出的 Using Visual Basic 5,及MS Excel Visual Basic Guide 。<p>VB 程式简例(其中有些 code 你可以不理):<p> Set Excel = CreateObject("Excel.Application")<br> Set xlBook = Excel.Workbooks.Open(gsStdDatabaseLocal & "\pcb97cht.xls", False, False)<p> Set xlSheet = xlBook.Worksheets(3)<p> ' Excel.Visible = True<br> xlSheet.Activate<br> xlSheet.Columns("A:D").ClearContents<br> <br> nRow = 0<br> ssD62.MoveFirst<br> Do While Not ssD62.EOF<br> nRow = nRow + 1<br> xlSheet.Cells(nRow, 1).Value = ssD62!DeptCode<br> xlSheet.Cells(nRow, 2).Value = ssD62!CCYY<br> xlSheet.Cells(nRow, 3).Value = ssD62!Amt<br> ssD62.MoveNext<br> Loop<br> Else<br> MsgBox "No data found"<br> Set ssD62 = Nothing<br> Exit Sub<br> End If<br> <br> 'Passing the parameter list to excel which is used for the macro call<br> Set xlSheet = xlBook.Worksheets(1)<br> xlSheet.Activate<br> xlSheet.Rows("2").ClearContents<br> xlSheet.Cells(2, 1).Value = "DrawCpare()"<br> xlSheet.Cells(2, 2).Value = sCompCode<br> xlSheet.Cells(2, 3).Value = sCompName<br> xlSheet.Cells(2, 4).Value = sYear<br> xlSheet.Cells(2, 5).Value = sMonth<br> xlSheet.Cells(2, 6).Value = mGetUnit(sUnit)<br> xlSheet.Cells(2, 7).Value = mGetUnitStr(sUnit)<br> xlSheet.Cells(2, 8).Value = IIf(sAccu, "TRUE", "FALSE")<p> 'Call a Macro Function To Update or Draw the Chart<br> xlBook.Application.Run ("DrawCpare")<br> Excel.Application.ScreenUpdating = True<br> Excel.ActiveWorkbook.Saved = True<br> Clipboard.Clear<br> xlBook.activeChart.ChartObjects.Copy<br> picChart.Picture = Clipboard.GetData()<br> 'Excel.Visible = False<br> Clipboard.Clear<br>
<br>
<br><hr size=7 width=75%><p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 7369-->
<!--top: 7421--><li><a href="7421.html">Re: 当然可以</a> <b>VBA 新手</b> <i>20:10:21 11/17/98</i>
(<!--responses: 7421-->0)
<ul><!--insert: 7421-->
</ul><!--end: 7421-->
</ul><!--end: 7369-->
<br><hr size=7 width=75%><p>
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?