摘要:使用VB.NET开发复合控件界面:控件类型名称 文本ListBox lstSourceListBox lstTargegButton btnAddAdd >Button btnAddAllAdd All >>Button btnRemove < RemoveButton btnClear << Clear代码如下: 1 Public Class SelectCombo 2 Inherits System.Windows.Forms.UserControl 3 4 ' Make the width of the area for the buttons
阅读全文
随笔分类 - ASP(VB/VBA)
摘要:Function InsertIntoDoc(strPath as string)
Set fso=CreateObject("Scripting.FileSystem")
阅读全文
摘要:可以编写一宏,使导出的文件与原文件完全一样Sub DoIt() Dim o As OLEObject Dim TargetDir As String '导出文件的目标目录 TargetDir = "D:\" Dim CmdLine As String '使用"",是为了防止文件夹带空格 CmdLine = "explorer.exe " & """" & TargetDir & """" '包含包对象的OLE
阅读全文
摘要:‘删除Sheet1上的单元格区域A1:D10,并将其余单元格左移以填补被删除单元格的位置
Sheet1.Range(“A1:D10”).Delete Shift:=xlShiftToLeft
阅读全文
摘要:以下示例从另一个WORD文档,并从中复制数据到本地表中
Private Sub CommandButton1_Click()
Dim i As Integer
Dim f As Document
阅读全文
摘要:‘从活动单元格向上12行到向上1行的总和
ActiveCell.FormulaR1C1=”SUM(R[-12])C:R[-1]C”
‘引用第C-D列和第F-G列
Range(“B2:D6”)
‘引用B2-D6的单元格 同Range(“B2”,”D6”) ,Rangge(Cells(2,2),Cells(6,4))
‘引用第2行3列
Cells(2,3) 或Cells(2,”C”)
阅读全文
摘要:引用 经典Excel VBA代码2010-06-15 15:03:18|分类: 默认分类 |标签: |字号大中小订阅本文引用自晗露《经典Excel VBA代码》引用晗露 的 经典Excel VBA代码经典Excel VBA代码 收藏 VBA基础在大家的关注声中即将告一段落了,有许多经典的VBA操作我们只是作了简要的介绍,想要熟练地使用VBA还需要大家慢慢地去消化和吸收,然后在实践中总结和提高。最后我们收集了常见的VBA代码以飨广大的读者,希望对大家有所启示。Application(Excel程序)篇view plaincopy to clipboardprint?Application.Ena
阅读全文
摘要:1.Excel中激活WordApplication.ActivateMicrosoftApp xlMicrosoftWord2.Excel中打开文件查找框 Application.FindFile3.Excel中运行宏 Application.Run MacroName:="人口预测" 4.Excel的保存ActiveWorkbook.Save5.为当前工作簿设置密码Sub Protect_Book()ActiveWorkbook.Protect Password:="Protect",Structure:=True,Windows:=TrueEnd S
阅读全文
摘要:‘将文件夹下的所有txt文件加载到本文档中Function InsertIntoDoc(strPath as String)Set fso=CreateObject("Scripting.FileSystemObject”) Set objFolder=fso.GetFolder(strPath)Set objFiles =objFolder.FilesStr1=””For Each objFile In objFilesDebug.Print objFile.NameSet fout=fso.OpenTextFile(strPath & “\” & objFile.
阅读全文
摘要:语法高亮可使用VBA中的查找替换功能,如对于Delphi可先查找到关键字,然后将其设为蓝色即可,具体代码为: 1 Sub Replace1() 2 3 Dim i As Integer 4 5 Dim arr(15) as String 6 7 arr(0)="type" :arr(1)="class" : arr(2) ="unit" : arr(3)="begin" : arr(4)="end" : arr(5)="if" : arr(6)="else"
阅读全文
摘要:最近在学VBA,因为在看《WORD排班艺术》一书中,上面所写到我们只用到OFFICE的10%的功能,还有90%没有使用,或者我们不知道如何使用,故决定深入研究一番VBA,通过这几天对VBA的初步了解,感觉这里面确实有很多学问,如果能活用VBA宏代码,的确能省事不少,而且就可以说精通OFFICE了吧,下面为一些简单的VBA代码
阅读全文
摘要:1.在许多论坛的登录页面上,都有一个附加码,这样做的目的是防止有人利用破解程序,暴力破解里面的密码2.生成附加码的代码:<%Response.Buffer=falseNumCodeFunction NumCode()Response.Expires=-1Response.AddHeader "Progma","no-cache"Response.AddHeader "cache-control","no-cache"dim rndnum,i,jdim Ados,Ados1Do While len(rndnum
阅读全文
摘要:set myMail=CreateObject("CDONTS.NewMail")myMail.SetLocalIDS(65001)myMail.From=txtMailFrommyMail.To=txtMailTomyMail.Subject="Subject"myMail.BodyFormat=0myMail.MailFormat=0myMail.Body=mailbodymyMail.SendSet myMail=Nothing在发送的ASP页面中写入@LANGUAGE=VBScript CODEPAGE=65001session.CodePage
阅读全文
摘要:userip=Request.ServerVariables("HTTP_X_FORWORD_FOR")if userip="" thenuserip=Request.ServerVariables("REMOTE_ADDR")End if
阅读全文
摘要:<table width="100%" height="49" border="0" cellspacing="1" cellpadding="3" bgcolor="#CCCCCC">其中重点是cellspacing="1" cellpadding="3" bgcolor="#CCCCCC" 其中bgcolor可以换成需要的颜色,还有bordercolordark和bordercolorlight连个属
阅读全文
摘要:一、计算unicode字符串的Ansi编码的长度Function strUnicodeLen(asContents)asContents1="a" & asContentslen1=len(asContents1)k=0for i=1 to len1asc1=asc(mid(asContents1,i,1))if asc1<0 then asc1=65536+asc1if asc1>255 thenk=k+2elsek=k+1end ifnextstrUnicodeLen=k-1End Function二、将Unicode编码的字符串转换为Ansi编码的
阅读全文
摘要:一.用HTML元素对象的onselectstart事件防止用户选择网页方法是body中插入如下代码 <body onselectstart="return false">二.用HTML元素对象的oncopy和oncut事件防止用户复制网页内容,方法是在body中插入如下代码:<body oncopy="return false" oncut="return false">三.用HTML元素对象的onpaste事件防止用户粘贴网页的内容,方法是在body中插入如下代码:<body onpaste="
阅读全文
摘要:<html><head><title>浏览器选择</title> <%Dim BrowseMsgBrowseMsg=Request.ServerVariables("HTTP_USER_AGENT")Response.Write(BrowseMsg)If Instr(BrowseMsg,'FireFox')>0 thenResponse.Write('为FireFox浏览器')ElseIf instr(BrowseMsg,'MSIE')>0 thenRespon
阅读全文