Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共10 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:文本框查询excel表

1楼
g1j2h3 发表于:2025/2/28 12:47:00
窗口中有一个文本框和一个按钮,我想通过按钮在指定文件夹下找到和文本框内容一样的excel表,并给其给其指定单元格内赋值,请大师指教
Dim txt As String = e.Form.Controls("TextBox1").Text
Dim web As WinForm.WebBrowser = e.Form.Controls("WebBrowser1")
For Each File As String In FileSys.GetFiles("l:\产品料单")
    If file.EndsWith(".xls") = "txt.xls" Then
        web.OfficeToolBar = True
        web.Address = "txt.xls"
    End If
Next
2楼
有点蓝 发表于:2025/2/28 13:20:00
参考:http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&Id=149103
3楼
g1j2h3 发表于:2025/2/28 13:42:00
请大师再指导下如何按文本框内容找到文件夹下匹配的excel表
4楼
有点蓝 发表于:2025/2/28 13:43:00
匹配的excel的文件名称?还是匹配excel里面某个单元格?
5楼
g1j2h3 发表于:2025/2/28 13:51:00
匹配excel的文件名称
6楼
有点蓝 发表于:2025/2/28 13:52:00
For Each File As String In FileSys.GetFiles("l:\产品料单")
    If file.EndsWith(txt & ".xls") Then
        web.OfficeToolBar = True
        web.Address = File 
exit for
    End If
Next
7楼
g1j2h3 发表于:2025/2/28 13:53:00
谢谢蓝老师,我先试试
8楼
g1j2h3 发表于:2025/2/28 14:28:00
如果我要查询("l:\产品料单")及其子文件夹,该如何写代码
9楼
有点蓝 发表于:2025/2/28 16:30:00
增加一个自定义函数名称:abc,函数内容

dim dir as string = args(0)
dim txt as string = args(1)
For Each File As String In FileSys.GetFiles(dir )
    If file.EndsWith(txt & ".xls") Then
       return File 
    End If
Next
For Each dir2 As String In FileSys.GetDirectories(dir) 如果有子目录
  dim s as string = 
Functions.Execute("abc",dir2 txt 
if s > "" then
retutn s
end if
Next
return ""

按钮
Dim txt As String = e.Form.Controls("TextBox1").Text
Dim web As WinForm.WebBrowser = e.Form.Controls("WebBrowser1")
dim file as string =  Functions.Execute("abc","l:\产品料单",txt )
    If file > "" Then
        web.OfficeToolBar = True
        web.Address = File 
else
msgbox("没有找到")
    End If
10楼
g1j2h3 发表于:2025/2/28 16:49:00
非常感谢大师的指导
共10 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02344 s, 2 queries.