<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    夢幻之旅

    DEBUG - 天道酬勤

       :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      671 隨筆 :: 6 文章 :: 256 評論 :: 0 Trackbacks
    '******************************************************************************
    '
    * File:     excel2pdm.txt
    '
    * Title:    pdm export to excel
    '
    * Purpose:  To export the tables and columns to Excel
    '
    * Model:    Physical Data Model
    '
    * Objects:  Table, Column, View
    '
    * Author:   ziyan
    '
    * Created:  2012-05-03
    '
    *Modifier:  Hui Wanpeng 2014/07/04
    '
    * Version:  1.0
    '
    ******************************************************************************
    Option Explicit

    Dim md1 'the current model
    Set md1=ActiveModel
    If(md1 Is NothingThen
      
    MsgBox "There is no Active Model"
    End If

    Dim HaveExcel
    Dim RQ
    RQ 
    = vbYes 'MsgBox("Is Excel Installed on your machine?",vbYesNo+vbInformation,"Confirmation")

    If RQ=vbYes Then
      HaveExcel
    =True
      
    'Open&Create Excel Document
      Dim x1
      
    set x1=CreateObject("Excel.Application")
      x1.Workbooks.Open 
    "E:/tmp/B超檢查表.xls"
      x1.Workbooks(
    1).Worksheets("Sheet1").Activate
    Else
      HaveExcel
    =False
    End If

    process x1, md1

    sub process(x1,md1)
        
    dim rwIndex
        
    dim tableName
        
    dim colname
        
    dim table
        
    dim col
        
    dim count
        
    dim dType
        
    dim nNull

        
    'on error Resume Next
        For rwIndex =1 To 500 step 1
           
    With x1.Workbooks(1).Worksheets("Sheet1")
              
    If .Cells(rwIndex,1).Value="" Then
                 
    Exit For
              
    End If
              
    If .Cells(rwIndex,3).Value="" Then
                  
    set table=md1.Tables.CreateNew
                  table.Name
    =.Cells(rwIndex,2).Value
                  table.Code
    =UCase(.Cells(rwIndex,1).Value)
                  table.Comment
    =.Cells(rwIndex,2).Value
                  count
    =count+1
              
    Else
                  colName
    =.Cells(rwIndex,1).Value
                  
    set col=table.Columns.CreateNew
                  
                  
    'MsgBox.Cells(rwIndex,1).Value
                   'MsgBox colName,vbOK+vbInformation,"列"
                  col.Code=Trim(UCase(.Cells(rwIndex,1).Value))
                  col.Name
    =Trim(UCase( .Cells(rwIndex,1).Value))
                  col.Comment
    =Trim(.Cells(rwIndex,2).Value)
               
                  dType
    =Trim(UCase(.Cells(rwIndex,3).Value))
                  
    'MsgBox Left(dType, 5)
                  If Left(dType, 5)="CHAR(" Then
                      dType
    =Replace(dType,"CHAR","VARCHAR2")
                  
    ElseIf Left(dType, 5)="CAHR(" Then 
                      dType
    =Replace(dType,"CAHR","VARCHAR2")
                  
    End If
                  col.DataType
    =dType
               
                  nNull
    =Trim(UCase(.Cells(rwIndex,4).Value))
                  
    If nNull="NOT NULL" then
                    col.Mandatory
    ="true"
                  
    End If
               
             
    End If
           
    End With
        
    Next

        
    MsgBox "生成數據表結構共計 " + CStr(count), vbOK+vbInformation, ""
        x1.Workbooks.Close
        
    Exit Sub

    End Sub


    posted on 2014-07-06 21:06 HUIKK 閱讀(390) 評論(0)  編輯  收藏 所屬分類: VB/VBA/VBS

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 欧美最猛性xxxxx免费| 在线看片免费人成视频久网下载| 日本免费一区二区三区四区五六区| 亚洲区日韩区无码区| 免费亚洲视频在线观看| 免费一级e一片在线播放| 在线91精品亚洲网站精品成人| 毛色毛片免费观看| 亚洲AV无码成人精品区狼人影院 | 亚洲精品无码久久久久A片苍井空| 亚洲免费二区三区| 亚洲a级片在线观看| 成年丰满熟妇午夜免费视频| 亚洲精华国产精华精华液网站| 女人18毛片水真多免费看| 亚洲第一综合天堂另类专 | 国产亚洲男人的天堂在线观看| 吃奶摸下高潮60分钟免费视频| a级毛片免费高清视频| 亚洲国产精品无码成人片久久| 日韩免费无码视频一区二区三区 | 亚洲成A∨人片天堂网无码| 中美日韩在线网免费毛片视频| 亚洲永久精品ww47| 7x7x7x免费在线观看| 亚洲熟妇自偷自拍另欧美| 亚洲精品在线视频| 91精品导航在线网址免费| 亚洲AV综合色区无码一二三区| 精品国产日韩亚洲一区| 99久久久国产精品免费牛牛| 亚洲精品人成网在线播放影院| 亚洲第一永久AV网站久久精品男人的天堂AV| 99久久成人国产精品免费| 亚洲国产人成在线观看| 波多野结衣视频在线免费观看| 午夜理伦剧场免费| 国产成人久久精品亚洲小说| 亚洲精品线在线观看| 国产成人免费手机在线观看视频| 国产99视频精品免费专区|