| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 728 人关注过本帖
标题:求助attribute
只看楼主 加入收藏
hn2002
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2008-9-1
收藏
 问题点数:0 回复次数:2 
求助attribute
我有一个.bas文件但是不知道如何在vb中使用,是把代码拷贝到vb中作为函数执行么?代码参见下面



Attribute VB_Name = "Module1"
Const WINSYSTEM = False
Const TMPPATH = "c:\temp\convert\"
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub printhtml(htmlContent As String)
    Send "Status: 200 OK"
    Send "Content-type: text/html" & vbCrLf
    Send "<HTML><HEAD><TITLE>Message from CGI</TITLE></HEAD>"
    Send "<BODY>"
    Send htmlContent
    Send "</BODY></HTML>"
End Sub

Sub CGI_Main()
    Dim upfile As String
    Dim fullname As String
    Dim htmname As String
    upfile = GetCgiValue("uploaded_file")
    'upfile = "file"
    If Len(upfile) Then
        If WINSYSTEM Then
            Sleep 10000
        End If
        Dim WordApp  As New Word.Application
        fullname = TMPPATH & upfile & ".doc"
        htmname = TMPPATH & upfile & ".htm"
        WordApp.Visible = True
        WordApp.DisplayAlerts = wdAlertsNone
        WordApp.Documents.Open fullname
        'adjust the format
        With WordApp
            With .ActiveDocument.WebOptions
                .Encoding = 65001
                .RelyOnCSS = True
                .OptimizeForBrowser = True
                .BrowserLevel = 0
                .OrganizeInFolder = True
                .UseLongFileNames = True
                .RelyOnVML = False
                .AllowPNG = False
                .ScreenSize = msoScreenSize800x600
                .PixelsPerInch = 96
            End With
            'ActiveDocument.WebOptions.
            .ActiveDocument.SaveAs htmname, 10
            .ActiveDocument.Close
        End With
        WordApp.Quit SaveChanges:=wdDoNotSaveChanges
        If WINSYSTEM Then
            Sleep 10000
        End If
        printhtml ("Success")
    Else
        printhtml ("No file uploaded")
    End If

End Sub
搜索更多相关主题的帖子: attribute 
2008-09-02 14:19
aspd199
Rank: 1
来 自:宇宙
等 级:新手上路
威 望:1
帖 子:62
专家分:0
注 册:2008-4-17
收藏
得分:0 
VB里新建一个模块
把以上代码复制进去即可(去除第一行)

8620高手挑战站
http://
2008-09-02 18:17
不说也罢
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:39
帖 子:1481
专家分:4989
注 册:2007-10-7
收藏
得分:0 
楼主把你的.bas文件直接添加到工程里不就行了么?
工程——添加模块——现存,然后找到你的.bas文件

[[it] 本帖最后由 不说也罢 于 2008-9-2 19:12 编辑 [/it]]

===================================================
讨厌C#的行尾的小尾巴;和一对大括号{ }
===================================================
2008-09-02 19:10
快速回复:求助attribute
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014472 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved