WORD VBA 之 WebBrowser控件 出现错误的问题 请问一下如何修改?

一个VBA出现错误的问题,请问一下如何修改:
我在窗体UserForm2新增一个WebBrowser控件
然后在模块写一个子程序,想透过UserForm2的WebBrowser1上网查单字,如下

Sub bing查单字测试()
UserForm2.WebBrowser1.Navigate2 "https://www.bing.com/translator/…"
'最后的Test就是要查的单字

aty = UserForm2.WebBrowser1.Document.GetElementById("t_dummydiv").innerText
'执行到这里出现 "运行时错误91 没有设定对象变量或with局部变量"

MsgBox aty
End Sub


2个回答

搞了一天,原来不能定义成HTMLDocument或HTMLElement或String。
.value也没用。 必须定义成Variant。

Sub bing查单字测试()
Dim aty As Variant '原来这里要定义成Variant

UserForm2.WebBrowser1.Navigate2 "https://www.bing.com/translator/…"
'最后的Test就是要查的单字

aty = UserForm2.WebBrowser1.Document.GetElementById("t_dummydiv").innerText
'执行到这里出现 "运行时错误91 没有设定对象变量或with局部变量"

MsgBox aty
End Sub

可能是网页没有载入就执行到下面了
可以用
UserForm2.WebBrowser1.Navigate2 "https://www.bing.com/translator/…"
while UserForm2.WebBrowser1.IsBusy
doevents
wend
下面的代码

ggeess12000
ggeess12000 .IsBusy有错误,好像要改成 .Busy。不管停多久,下句还是一样,是不是少set 或dim 了甚么?
4 个月之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
请问一下我的WebBrowser控件为什么出现91号错误
WebBrowser.Navigate "about:blank"rnWebBrowser.Document.write "abc" 出错rnrnObject variable or With block variable not set (Error 91)rnrnrn
请问VBA如何调用WORD
请问VBA如何调用WORD?
VBA 中如何控制 webbrowser控件
根据需求 我需要写这么一个程序:rn在Excel中加入一个command button和webbrowser控件。 当点击按钮时,将工作表中的数据填入webbrowser中的一个网页上。rnrn我想用Sendkeys来实现向网页提交数据的功能,但发现无法将焦点置于webbrowser上。 rnrn有没有人实现过类似的功能? 烦请帮忙
请问一下webbrowser控件在WPF下的使用
我想编写一个小型的浏览网页的工具,要求使用webbrowser控件,即System.Windows.Controls.webbrowser控件。rn在实现类似IE中的“停止”功能时发现System.Windows.Controls.webbrowser控件不像System.Windows.Forms.webbrowser控件直接有webbrowser.Stop()的方法。于是请问这个代码怎么写啊?(VB环境下)rn另外,还有“主页”功能,也因为没有webbrowser.GoHome()而导致我无从下手,望有牛人告之。rn谢谢
请教一下,WORD VBA插入图片代码问题
[img=https://img-bbs.csdn.net/upload/201612/27/1482820730_416097.png][/img]rnrn如图中框出的代码未加入时整体代码运行OK的,加入框出的代码在此处后,打开文档时就打不开,一直在假死状态。rn麻烦各位帮我看看是什么问题rnrn[code=vb]Private Sub Document_Open()rnrnSelection.Find.ClearFormatting '查找文档是否有生产确认文字rn With Selection.Findrn .Text = "生产确认"rn .Replacement.Text = ""rn .Forward = Truern .Wrap = wdFindStoprn .Format = Falsern .MatchCase = Falsern .MatchWholeWord = Falsern .MatchByte = Falsern .MatchAllWordForms = Falsern .MatchSoundsLike = Falsern .MatchWildcards = Truern End WithrnDo While Selection.Find.Executern '目标事件rnDim myfile As FileDialog '//以下插入图片rnDim myW As Single, myH As Singlern myW = 2rn myH = 1.7rn Set mypic = Selection.InlineShapes.AddPicture(FileName:="D:\logo.jpg", SaveWithDocument:=True)rn mypic.Width = CentimetersToPoints(myW)rn mypic.Height = CentimetersToPoints(myH)rn Set myfile = Nothing '//插入图片结束rn rn Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft '录制的宏rn Selection.TypeText Text:=" "rn Selection.TypeText Text:=" "rn Selection.TypeText Text:=" "rn rnLooprnEnd Sub[/code]
出现如下错误,如何修改?
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']' in E:\www\php\vhc\admin\content_res.php(777) : eval()'d code on line 152rnrn此行代码为rneval("\$content_block = \"".$this->iTemplate->getTemplate("content_editsoft")."\";");
帮忙修改一下改写程序出现的错误
怎么样把写好的c程序改编成c++程序,我改的程序有太多的基本结构错误,可我在书上的语法学习中也没有领悟到怎么改,大家帮一下忙,帮我改一下。rn这是个双基回文数;#includern#includernint pku(long int x)rnrn char s[40];rn int n,i;rn sprintf(s,"%ld",x);rn n=strlen(s);rn for(i=0;i=0;j--)rn s=s*10+a[j];*/rn for(int x=1;x<=k;x++)rn rn int t=1;rn for(int y=x;y=2)rn ok=0;break;rn rn if(!ok)rn printf("%ld\n",i);break;rn rn return 0;rnrn 把双基回文数做成一个类,由于出现的错误,我无法改正,后面也没有写。rn#includern#includern#define N 100rnusing namespace std;rnclass Doubplindrnrnpublic:rn int plind(x);rn int convert(x,y);rnprivate:rn long int x;rn int y;rn;rnDoubplind::plind(long int x)rnrn int a[N];rn sprintf(a,"%d",x);rn int n=strlen(a);rn for(int i=0;i
VBA学习之WEBBROWSER控件
VBA 与 WEBBROWSER的精彩结合,想学习VBA 登录网页的朋友可以尝试下载
WebBrowser控件和Accelerators出现的问题。
我在CWnd里创建 WebBrowser 控件。rn结果在webbrowser中tab、delete等按键无效。rnrn遵照Knowledge Base里Q165074的介绍rnrn我重载了CMyWnd的PreTranslateMsg函数:rnrn BOOL CMyWnd::PreTranslateMessage(MSG* pMsg)rn rn if(IsDialogMessage(pMsg))rn return TRUE;rn elsern return CWnd::PreTranslateMessage(pMsg);rn rnrn结果程序原来的加速键又全都无效了,原因是PreTranslateMessage把WM_KEYDOWN给return TRUE;了。rnrn我想两全其美,请教大家。
请问如何加载webbrowser控件?
请问如何加载webbrowser控件?rn我怎么载compents中找不到webbrowser呢?
请问一下如何修改呢
[code=php]RewriteEngine OnrnRewriteRule ^(\w+)$ index.php\/Index\/$1rnRewriteRule ^qiu\/(\d+)$ index.php\/Index\/qiu\/$1rnRewriteRule ^(\w+)\/(\w+)$ index.php/Index\/$1\/$2 rnRewriteRule ^(\w+)\/(\w+)\/(\w+)$ index.php/Index\/$1\/$2\/$3rnRewriteRule ^tag\/(.*?)$ index.php\/Index\/tag\/$1rn[/code]rn这伪静态规则在Apache正常的,在iis6下大部能用就是/tag/[color=#FF0000]??[/color] 问号部分是中文章就会是乱码,请问我该 如何修改..rnrn 在iis下点tag打开的页面tag名会是乱码,其他文字正常。
word程序出现错误
word程序出现错误我 觉得一可能是word程序出现错误,重新安装修复就可以了,但是得有office的安装光盘
请问apache.jasper.JasperException错误如何修改
本人使用J2SE进行web开发,但是运行时却出现如下错误,请问如何进行修改;rnrntype Exception reportrnrnmessagernrndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnrnexceptionrnrnorg.rnapache.jasper.JasperExceptionrn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)rn at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)rn at java.lang.Thread.run(Thread.java:534)rnrnrnroot causernrnrnjavax.servlet.ServletExceptionrn at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:536)rn at org.apache.jsp.index_jsp._jspService(index_jsp.java:216)rn at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)rn at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)rn at java.lang.Thread.run(Thread.java:534)rnrnJSP编译后的JAVA文件index_jsp.java见附件。rnrnrnthanks!!rn
word中VBA问题
我有一大批word文档,格式是:每个文档中都含有一个插入的EXCEL表对象(EXCEL表对象格式都一样)。我需要编程从EXCEL表对象提取数据,我用的是BCB5,虽然我会用OLE,但是,我怎样在word中使用OLE选中EXCEL表对象?我打开WORD文档,准备录制宏,发现在录制宏的过程中,不能选择EXCEL表对象,如果选择EXCEL表对象后再录制,结果录制的宏又成了EXCEL了面的,怎么办?急。。。。。。rnrnrn
Word中的VBA问题
写了段程序,执行的时候出现“内存不足”的提示,rn但是通过通过任务管理器看到的内存使用情况为还有将近一半的内存没有使用rnrn还有一个是出现91错误,说“未设置的with语句块”,可是我明明没有用到with语句块的呀,不明白是怎么回事
如何屏蔽webBrowser控件的javascript的错误
如何屏蔽webBrowser控件的javascript的错误
请问这个错误如何出现的?
我的程序运行的时候发生非法操作,调试时运行到一半谈出下列错误,请问可能是什么原因导致的,应该如何避免:rnUnhandled exception in AsyncClient.exe:0xc00000005:Access Violationrn我在类中定义两个指针rnBYTE pBuffer;rnBYTE pTemp;rn初始化时:rnpBuffer=new BYTE[1000000];rnmemset(pBuffer,0,sizeof(pBuffer));rnpTemp=pBuffer;rn跟我这样定义有关系吗?rn请教,解决了就给分!
VBA操作word的问题
现在想要实现从其它文档复制内容到当前活动文档中,当按下ctrl+v粘贴到当前文档时就检查内容的格式,请问如何实现啊?
WORD VBA问题求教
各位高手们,求教!我想要设计一个WORD 里的类似于插件的东西, 实现选中WORD中某些文字,然后在编好的一个窗体中点击某个按钮在其前后加入某些标示,如 文字 这样的,我现在窗体已经设计好了,但是一运行窗体,文字部分就无法操作,也就无法实现这个功能,请问这个问题可以解决吗??rn[img=https://img-bbs.csdn.net/upload/201501/30/1422583423_394976.png][/img]
WORD中的VBA问题
我用WORD中的VBA编程,运行时老是出现文件模式错误,但是在别人机子上运正常,我把OFFICE卸了重装还是不行,而且我卸载的过程中提示WORD出现问题需要关闭,其实WORD已经关了.我想请问哪位高手怎么样才能把OFFICE彻底从计算机中删除.拜托了.
vba for word问题
怎样找到文档中所有",并且这个"是每行的第一个字符.rnrn我想到的解决方法是,找回车字符加"字符.可回车用什么表示?
word VBA问题
用VBA处理过的.doc文件,为什么到其他的电脑上就不能运行了?rn我是用word 2003 的,其他电脑装的也是相同的版本的
Word的VBA问题
根据Word里面的章节分割Word~大侠们~~谁有VBA或者方法~非常感谢
word vba 复制粘贴问题
我要做个程序。A文件夹中有数个(比如9个)格式一样的文件,我要把每个文件中的特定字符串,比如“名字”(每个文件“名字”后跟的人名不同)后的人名依次复制粘贴到B文件夹中的相应文件中。请问该怎么写这个程序呢。我做了个,可是有问题。只能得到A文件夹下当前打开的文档中“名字”后的人名,然后在B文件夹中创建9个文档,其中的人名都一样。程序如下:rnPrivate Sub CommandButton1_Click()rn rn Dim sFolder As String '得文件夹中文件数目及每个文档的名字rn Dim td As Documentsrn Dim i As Long 'iuoikjrn Dim x As Integerrn Dim arr() As Stringrn rn With Application.FileSearchrn .NewSearchrn .LookIn = "D:\wddoc2\wddoc"rn .SearchSubFolders = Truern .FileName = "*.doc"rnIf .Execute() > 0 Thenrn x = .FoundFiles.CountrnrnReDim arr(1 To x)rn rn For i = 1 To xrn rn ChangeFileOpenDirectory "D:\wddoc2\wddoc\"rn rn arr(i) = Replace(.FoundFiles(i), "D:\wddoc2\wddoc\", "")rn 'MsgBox Len(arr(i))rn rn 'MsgBox arr(i)rn arr(i) = Right(arr(i), Len(arr(i)) - 1)rn 'MsgBox arr(i)rn rn rn On Error Resume Nextrn 'MsgBox arr(i)rn 'Application.ActiveDocument.Closern Documents.Open FileName:=arr(i), ConfirmConversions:=False, ReadOnly _rn :=False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate _rn :="", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="" _rn , Format:=wdOpenFormatAuto, XMLTransform:=""rn Selection.Find.ClearFormattingrn With Selection.Findrn .Text = TextBox1.Textrn .Replacement.Text = ""rn .Forward = Truern .Wrap = wdFindContinuern .Format = Falsern .MatchCase = Falsern .MatchWholeWord = Falsern .MatchByte = Truern .MatchWildcards = Falsern .MatchSoundsLike = Falsern .MatchAllWordForms = Falsern End Withrn Selection.Find.Executern Selection.MoveRight Unit:=wdCharacter, Count:=2rn Selection.EndKey Unit:=wdLine, Extend:=wdExtendrn Selection.Copyrn rn ChangeFileOpenDirectory "D:\wddoc2\22\"rnrn rn Documents.Open FileName:="22.doc", _rn ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _rn PasswordDocument:="", PasswordTemplate:="", Revert:=False, _rn WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _rn wdOpenFormatAuto, XMLTransform:=""rn rn Selection.Find.ClearFormattingrn With Selection.Findrn .Text = "名字"rn .Replacement.Text = ""rn .Forward = Truern .Wrap = wdFindContinuern .Format = Falsern .MatchCase = Falsern .MatchWholeWord = Falsern .MatchByte = Truern .MatchWildcards = Falsern .MatchSoundsLike = Falsern .MatchAllWordForms = Falsern End Withrn Selection.Find.Executern Selection.MoveRight Unit:=wdCharacter, Count:=2rn Selection.PasteAndFormat (wdPasteDefault)rn rn ActiveDocument.SaveAs FileName:="D:\wddoc2\22\" & i & ".doc", FileFormat:=wdFormatDocument, _rn LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _rn :="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _rn SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _rn Falsern ActiveDocument.Closern rn ' Documents.Close FileName = arr(i)rn ChangeFileOpenDirectory "D:\wddoc2\wddoc"rnrn rn rn Next irn Elsern MsgBox "Folder" & sFolder & " contains no required files"rn End IfrnEnd Withrn rn EndrnEnd Sub
word vba得问题
是这样,我的asp动态显示页面,我想,当我们的客户看完之后,觉得没有问题,就自动得把页面上的资料全部转化为word文件,打印出来!这样可以实现吗!
WebBrowser控件如何屏蔽javascript错误
WebBrowser 如何屏蔽javascript错误,我搜啊搜啊,搜到了 http://www.cnblogs.com/zhangqingping/archive/2009/06/16/1504260.html 和 http://support.microsoft.com/kb/261003 http://www.codeproject.com/Articles/4003/Popup-W...
请问一下做多文档时出现的错误!
我想作在多文档中对两个视图进行切换,写的方法在如下rn我在CMainFrame中:rnvoid CMainFrame::OnViewSwitch(int iChangeView)rnrn rn CView* pOldView = MDIGetActive()->GetActiveView(); ;rn ASSERT_VALID(pOldView);rn CView* pNewView = NULL;rnrn if(iChangeView == 1)rn rn pNewView = (CView*)new CHtmView;rn rn elsern rn pNewView = (CView*)new CMyView;rn rnrn ASSERT_VALID(pNewView);rn CCreateContext context;rn context.m_pCurrentDoc = pOldView->GetDocument();rn pNewView->Create(NULL, NULL, WS_BORDER|WS_CHILD, CFrameWnd::rectDefault,this, iChangeView ,&context);rn pNewView->OnInitialUpdate();rnrn SetActiveView(pNewView);rn pNewView->ShowWindow(SW_SHOW);rn pOldView->ShowWindow(SW_HIDE);rn //::SetWindowLong(pNewView->m_hWnd,GWL_ID,AFX_IDW_PANE_FIRST); rn rn RecalcLayout();rn delete pOldView;rnrn可是运行到RecalcLayout()时就会在objcore.cpp中的如下方法是的CRuntimeClass* pClassThis = GetRuntimeClass();出现错误。rnBOOL CObject::IsKindOf(const CRuntimeClass* pClass) constrnrn ASSERT(this != NULL);rn // it better be in valid memory, at least for CObject sizern ASSERT(AfxIsValidAddress(this, sizeof(CObject)));rnrn // simple SI casern CRuntimeClass* pClassThis = GetRuntimeClass();rn return pClassThis->IsDerivedFrom(pClass);rnrn错误提示:2.exe 中的 0x7c22700a (mfc71d.dll) 处未处理的异常: 0xC0000005: 读取位置 0xfeeefeee 时发生访问冲突 。rn我一直找不到错误不知道为什么呢?
写WORD VBA的问题
在word的vb编辑器里面执行没有问题,在pb里面却报错rnrn代码如下:rnOLEObject WordObjectrnrnWordObject = CREATE OLEObjectrnrnif WordObject.ConnectToNewObject("word.Application")<>0 then rn SetPointer(Arrow!)rn Destroy WordObjectrn messagebox("OLE错误","Word无法连接,请确认Word是否已经安装",stopsign!)rn returnrnend if rn//加载test.docrnWordObject.documents.add("test.doc",false,0)rn//往标签处写值,没有问题rnWordObject.ActiveDocument.Bookmarks.Item("aaa").Range.Text = 'aaa' rnrn//选择第一个表的第一行 rn这句报错 Error calling external object function tablesrn但是在word的vba编辑器中用ActiveDocument.Tables(1).Rows(1).Select没有问题 rnWordObject.ActiveDocument.Tables(1).Rows(1).Selectrn//在第一行下面插入一行 这句估计也不行rnWordObject.Selection.InsertRowsBelowrnrn请教应该如何写法?rnrn
VBA关于word的问题
Private Sub Command1_Click()rnDim docDocument As DocumentrnDim NumRows As IntegerrnDim docTable As Word.TablernDim iCount As IntegerrnDim docRange As Word.RangernDim docCell As Word.CellrnrnSet docApp = CreateObject("Word.Application")rn'Dim docWord As Objectrn'Set docWord = CreateObject("Word.Basic")rnrnSet docDocument = docApp.Documents.AddrnSet docDocument = docApp.ActiveDocumentrnrn'Set docTable = docDocument.Tables \'--->类型不匹配???rn'Set docRange = docTable.Rangern'rndocApp.Visible = TruernSet docTable = docDocument.Tables.Add(docDocument.Range(2, 2), 5, 6) '---》=。数值超出范围???rnFor Each oCell In docTable.Range.Cellsrn rn oCell.Range.InsertAfter "第 " & iCount & "单元格"rn iCount = iCount + 1rn rn Nextrn rndocDocument.SaveAs App.Path & "\\123.doc"rndocApp.QuitrnSet docApp = Nothingrnrn以下这两个问题怎么解决呀?很急人rnrn数值超出范围???rnrnrn--->类型不匹配???rnrn
word vba InsertRowsBelow的问题
For Each atable In ActiveDocument.Tablesrn c = atable.Rows.Countrn atable.Cell(c - 2, 1).Selectrn If Selection.Shading.BackgroundPatternColor <> wdColorGray15 Thenrn atable.Cell(c, 1).Selectrn Selection.InsertRowsBelow 1'加上这句以后死循环了rn End Ifrn Next atablern似乎InsertRowsBelow把for each中的计数归0了,总是循环本表,不知怎么回事,怎么解决??
有关Word的VBA问题
在word中的VBA的问题rn1、怎样才能使一幅图片不能被改动(包括大小、位置……所有信息),而其他不受影响;rn2、怎样使一个文档不能被操作(包括拷贝、另存……反正是所有的操作),rn activedocument.Protect wdAllowOnlyComments[,yourpwd] 不能完全保护!要更厉害的。rn急!要源代码!
帮我修改一下错误。
[code=SQL]rnCREATE FUNCTION [dbo].[GET_UDC]rn(rn @P01_DB varchar(6),rn @P02_SYSTEMCODE varchar(4),rn @P03_REASONTYPE varchar(2),rn @P04_KEY varchar(10)rn)rn--RETURNS INTrnASrnBEGINrnrnreturn (select drdl01 from dbo.f0005rnwhere drsy = rtrim(ltrim(@P02_SYSTEMCODE)) and drrt = rtrim(ltrim(@P03_REASONTYPE)) and rtrim(ltrim(drky)) = rtrim(ltrim(@P04_KEY)))rnrnENDrn[/code]rn执行报错:rn消息 156,级别 15,状态 1,过程 GET_UDC,第 9 行rn关键字 'AS' 附近有语法错误。rn消息 178,级别 15,状态 1,过程 GET_UDC,第 12 行rn在此上下文中不能使用带有返回值的 RETURN 语句。rn
修改主键出现错误
With dm.ADOq dornbeginrnClose;rnSQL.Clear;rnSQL.Add('Select * From weixiudan Where no='''+edit3.Text+'''');rnopen;rntryrnEdit; //修改记录rnFieldByName('ren').AsString:=cb4.Text;rnFieldByName('cj').AsString:=cb1.Text;rnFieldByName('no').AsString:=Edit3.Text;rnFieldByName('wangdianhao').AsString:=edit4.Text;rnPost;rnrefresh;rnshowmessage('修改成功');rnexceptrn showmessage('有误,请从新修改');rn end;rnend;rnrnrn我用这个程序修改表的一般字段都正确 ,修改表的主键NO时候不能修改,每次都会新建一行,怎么能直接修改 不新建一行记录?rn
请问以下代码编译时出现错误,如何修改?
错误行,小弟已经注释了.rnrnusing System;rnnamespace Critterrnrn /// rn /// Critter Menurn /// Build a basic menu structurern /// Andyrn /// rn class Menu rn rn static void Main(string[] args) rn rn bool keepGoing = true;rn int choice;rn Critter myCritter = new Critter();rn myCritter.Name = "George";rn while (keepGoing)rn rn myCritter.age(); //就是这一行有错误rn choice = showMenu();rn switch (choice)rn rn case 0:rn keepGoing = false;rn break;rn case 1:rn Console.WriteLine(myCritter.Talk());rn break;rn case 2:rn myCritter.Eat();rn Console.WriteLine ("You have fed the critter");rn break;rn case 3:rn myCritter.Play();rn Console.WriteLine("You have played with the critter");rn break;rn case 4:rn Console.WriteLine("Current name: 0", myCritter.Name);rn Console.Write("Change name to: ");rn myCritter.Name = Console.ReadLine();rn break;rn default:rn Console.WriteLine("That was not a valid input");rn break;rn // end switchrn // end while looprn // end mainrnrn static int showMenu()rn rn int input = 1;rn Console.WriteLine();rn Console.WriteLine();rn Console.WriteLine();rn Console.WriteLine();rn Console.WriteLine("0) Exit");rn Console.WriteLine("1) Listen to Critter");rn Console.WriteLine("2) Feed Critter");rn Console.WriteLine("3) Play with Critter");rn Console.WriteLine("4) Rename Critter");rn try rn rn input = Convert.ToInt32(Console.ReadLine());rn rn catch (FormatException) rn rn Console.WriteLine("Incorrect input");rn input = 1;rn // end tryrn return input;rn // end showMenurn //end class menurnrn class Critter rn rn private string pName;rn private int pFull = 10;rn private int pHappy = 10;rn private int pAge = 0;rn public string Name rn rn get rn rn return pName;rn // end getrn setrn rn if (value.Length > 8)rn rn Console.WriteLine("The name can't be more than 8 characters");rn pName = value;rn pName = pName.Substring(0,8);rn Console.WriteLine("Changing name to 0", pName);rn rn else rn rn pName = value;rn // end ifrn // end setrn // end name propertyrnrn public void Age()rn rn //handles aging the critterrn pAge++;rn pFull--;rn pHappy--;rn if (pFull < 3) rn rn //if hungry, accelerate unhappinessrn pHappy--;rn // end ifrn // end agernrn public void Eat()rn rn pFull += 4;rn // end eatrnrn public void Play()rn rn pHappy += 3;rn // end playrnrn public string Talk()rn rn string message;rn message = "The critter says: \n";rn if (pHappy > 5) rn rn message += " Hi! My name is " + Name + "\n";rn message += " I feel happy today! \n";rn rn else if (pHappy > 2) rn rn message += " " + Name + " doesn't feel so good...";rn rn else if (pHappy > 0) rn rn message += " " + Name + " is MAD...";rn rn else rn rn message += " ...nothing at all, but lays in a heap.";rn // end ifrn return message;rn // end talkrn // end class critterrn// end namespace
请问出现如下错误,该如何修改pppd的配置?
Using interface ppp0rnlocal IP address 10.64.64.64rnremote IP address 10.112.112.112rnStarting linkrnSerial connection established.rnusing channel 11rnConnect: ppp0 <--> /dev/pts/3rnsent [LCP ConfReq id=0x1 ]rnrcvd [LCP ConfReq id=0x1 ]rnsent [LCP ConfRej id=0x1 ]rnrcvd [LCP ConfRej id=0x1 ]rnsent [LCP ConfReq id=0x2 ]rnrcvd [LCP ConfReq id=0x2 ]rnsent [LCP ConfAck id=0x2 ]rnrcvd [LCP ConfAck id=0x2 ]rnsent [IPCP ConfReq id=0x1 ]rnsent [CCP ConfReq id=0x1 ]rnrcvd [LCP TermReq id=0x3 "peer refused to authenticate"]rnLCP terminated by peer (peer refused to authenticate)rnsent [LCP TermAck id=0x3]rnrcvd [LCP ProtRej id=0x4 80 fd 01 01 00 0c 1a 04 78 00 18 04 78 00]rnConnection terminated.rnSerial link disconnected.rnScript pppd (charshunt) finished (pid 9687), status = 0x0rnTerminating on signal 15.rn
请问这个程序出现的错误如何修改,多谢啦
#include rnusing namespace std;rnstruct Studentrnchar name[20];rn float score;rn;rn struct SqlistrnStudent data[100] ;rnint length;rn l="lihua",78;rnint main()rn int n;rn char name2[20];rn float m;rn cout<<"请问你要输入几个学生的成绩:";rn cin>>n;rn if(n<0 || n>100)rn cout<<"您的输入有误,请重新输入!";rn rn else rn for(int i=0;i>name2>>m;rn l.data[i].name=name2;rn l.data[i].score=m;rn l.length++;rn rn cout<<"姓名"<<" "<<"成绩"<
VBA WORD
请问用VBA来修改某个文件夹下面的大量WORD文档的创建时间,代码怎么写?rn讨教了
Word VBA
请教各位一个问题,在一个文档里,有很多[color=#FF0000]love[/color]这样的文字,如何通过代码让love加粗并把都删除.
Word的VBA
做OFFICE二次开发的参考资料,Word的VBA,这是office 2000的,新版Office只是增加了部分新功能,原理是相通的。
VBA word
怎样将光标定位到某一页的第一行?rn具体的来说,VBA操作word时,怎样有“页”的概念?rn帮帮忙,搞了一下午还没搞好
相关热词 c#检测非法字符 c#双屏截图 c#中怎么关闭线程 c# 显示服务器上的图片 api嵌入窗口 c# c# 控制网页 c# encrypt c#微信网页版登录 c# login 居中 c# 考试软件