Option Strict Off Imports System.IO Imports System.Net Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle Imports Microsoft.Office.Interop.Excel.Constants Imports Microsoft.Office.Interop.Excel.XlBordersIndex Imports Microsoft.Office.Interop.Excel.XlLineStyle Imports Microsoft.Office.Interop.Excel.XlBorderWeight Imports Microsoft.Office.Interop.Excel.XlThemeFont Imports Microsoft.Office.Interop.Excel.XlThemeColor Imports Microsoft.Office.Interop.Excel.XlWindowState Imports Microsoft.Office.Interop.Excel Imports System.Net.WebRequestMethods Public Class 模具開發控制表 Public Property Credentials As ICredentials Private ReadOnly ds, ds1, ds2, ds3 As New DataSet Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet Private Sub Set_楦頭規格表清單() 清單_dgv.DataSource = Nothing : ds.Clear() 清單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 清單_dgv.ColumnHeadersHeight = 25 清單_dgv.AllowUserToAddRows = False SQL_模具開發控制表清單() da.Fill(ds) : 清單_dgv.DataSource = ds.Tables(0) : conn.Close() 清單_dgv.Columns(0).Width = 142 : 清單_dgv.Columns(1).Visible = False : 清單_dgv.Columns(2).Visible = False : 清單_dgv.Columns(3).Visible = False 清單_dgv.Columns(4).Width = 142 : 清單_dgv.Columns(5).Visible = False : 清單_dgv.Columns(6).Visible = False : 清單_dgv.Columns(7).Visible = False 清單_dgv.Columns(8).Visible = False : 清單_dgv.Columns(9).Visible = False : 清單_dgv.Columns(10).Visible = False : 清單_dgv.Columns(11).Visible = False 清單_dgv.Columns(12).Visible = False : 清單_dgv.Columns(13).Visible = False : 清單_dgv.Columns(14).Visible = False End Sub Private Sub ComboBox1下拉表單資料載入() SQL_下拉清單1() 模具廠_cb.Items.Clear() : While (dr.Read()) : 模具廠_cb.Items.Add(dr("廠商")) : End While : conn.Close() End Sub Private Sub ComboBox2下拉表單資料載入() SQL_下拉清單2() 結構_cb.Items.Clear() : While (dr.Read()) : 結構_cb.Items.Add(dr("結構")) : End While : conn.Close() End Sub Private Sub ComboBox3下拉表單資料載入() SQL_下拉清單3() 材質_cb.Items.Clear() : While (dr.Read()) : 材質_cb.Items.Add(dr("材質")) : End While : conn.Close() End Sub Private Sub ComboBox4下拉表單資料載入() SQL_下拉清單4() 楦頭編號_cb.Items.Clear() : While (dr.Read()) : 楦頭編號_cb.Items.Add(dr("楦頭編號")) : End While : conn.Close() End Sub Private Sub ComboBox5下拉表單資料載入() SQL_下拉清單5() 品牌_cb.Items.Clear() : While (dr.Read()) : 品牌_cb.Items.Add(dr("CUST")) : End While : conn.Close() End Sub Private Sub ComboBox6下拉表單資料載入() SQL_下拉清單6() 大底廠_cb.Items.Clear() : While (dr.Read()) : 大底廠_cb.Items.Add(dr("廠商")) : End While : conn.Close() End Sub Private Sub ComboBox7下拉表單資料載入() SQL_下拉清單7() 季節_cb.Items.Clear() : While (dr.Read()) : 季節_cb.Items.Add(dr("SEASON")) : End While : conn.Close() End Sub Private Sub 模具開發控制表_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.MdiParent = WINPROFIT_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True ComboBox1下拉表單資料載入() : ComboBox2下拉表單資料載入() : ComboBox3下拉表單資料載入() : ComboBox4下拉表單資料載入() : ComboBox5下拉表單資料載入() : ComboBox6下拉表單資料載入() ComboBox7下拉表單資料載入() : Set_楦頭規格表清單() 模具開發單編碼_tb.Enabled = False : TextBox7.Visible = False : TextBox8.Visible = False : TextBox9.Visible = False 模具廠_cb.Enabled = False : 結構_cb.Enabled = False : 材質_cb.Enabled = False : 楦頭編號_cb.Enabled = False : 品牌_cb.Enabled = False : 大底廠_cb.Enabled = False : 季節_cb.Enabled = False 模具編號_tb.Enabled = False : 參考漾鞋編號_tb.Enabled = False : 尺寸_tb.Enabled = False : 備註_tb.Enabled = False : 儲存新增_bt.Enabled = False : 儲存修改_bt.Enabled = False 新增_bt.Enabled = True : 修改_bt.Enabled = True WINPROFIT_ERP_SYS.WindowState = 2 If FolderBrowserDialog1.ShowDialog = DialogResult.OK Then WebBrowser2.Navigate(FolderBrowserDialog1.SelectedPath) End If End Sub Private Sub 圖片導入() SQL_圖片導入() PictureBox1.Image = Nothing While dr.Read() = True Dim unused As Byte() = New Byte(-1) {} Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte()) Dim oStream As New MemoryStream(bytes) PictureBox1.Image = Bitmap.FromStream(oStream) End While conn.Close() PictureBox1.SizeMode = 4 End Sub Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 清單_dgv.CellClick If 新增_bt.Enabled = True Or 修改_bt.Enabled = True Then If e.RowIndex = -1 Then : Else 模具開發單編碼_tb.Text = 清單_dgv.Rows(e.RowIndex).Cells("模具開發單號").Value : 模具廠_cb.Text = 清單_dgv.Rows(e.RowIndex).Cells("模具廠").Value 結構_cb.Text = 清單_dgv.Rows(e.RowIndex).Cells("結構").Value : 材質_cb.Text = 清單_dgv.Rows(e.RowIndex).Cells("材質").Value 楦頭編號_cb.Text = 清單_dgv.Rows(e.RowIndex).Cells("楦頭編號").Value : 模具編號_tb.Text = 清單_dgv.Rows(e.RowIndex).Cells("模具編號").Value 參考漾鞋編號_tb.Text = 清單_dgv.Rows(e.RowIndex).Cells("參考原樣鞋編號").Value : 品牌_cb.Text = 清單_dgv.Rows(e.RowIndex).Cells("品牌").Value 大底廠_cb.Text = 清單_dgv.Rows(e.RowIndex).Cells("大底廠").Value : 尺寸_tb.Text = 清單_dgv.Rows(e.RowIndex).Cells("尺寸").Value 季節_cb.Text = 清單_dgv.Rows(e.RowIndex).Cells("季節").Value : 備註_tb.Text = 清單_dgv.Rows(e.RowIndex).Cells("備註").Value TextBox8.Text = 清單_dgv.Rows(e.RowIndex).Cells("制表").Value : TextBox9.Text = 清單_dgv.Rows(e.RowIndex).Cells("制表日期").Value CN_tb.Text = 清單_dgv.Rows(e.RowIndex).Cells("CN").Value 圖片導入() End If End If End Sub Private Sub Button7_Click(sender As Object, e As EventArgs) Handles 查詢_bt.Click PA = InputBox("請輸入要查詢的關鍵字") : Set_楦頭規格表清單() : PA = "" End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles 新增_bt.Click 模具廠_cb.Enabled = True : 結構_cb.Enabled = True : 材質_cb.Enabled = True : 楦頭編號_cb.Enabled = True : 品牌_cb.Enabled = True : 大底廠_cb.Enabled = True : 季節_cb.Enabled = True 模具編號_tb.Enabled = True : 參考漾鞋編號_tb.Enabled = True : 尺寸_tb.Enabled = True : 備註_tb.Enabled = True : 儲存新增_bt.Enabled = True : 儲存修改_bt.Enabled = False 新增_bt.Enabled = False : 修改_bt.Enabled = False ComboBox1下拉表單資料載入() : ComboBox2下拉表單資料載入() : ComboBox3下拉表單資料載入() : ComboBox4下拉表單資料載入() : ComboBox5下拉表單資料載入() : ComboBox6下拉表單資料載入() ComboBox7下拉表單資料載入() 模具編號_tb.Text = "" : 模具編號_tb.Text = "" : 參考漾鞋編號_tb.Text = "" : 尺寸_tb.Text = "" : 備註_tb.Text = "" : PictureBox1.Image = Nothing SQL_最後一筆模具開發單號() If dr.Read() Then : 模具開發單編碼_tb.Text = dr("模具開發單號").ToString : Else : 模具開發單編碼_tb.Text = "MD00000000" : End If conn.Close() Dim NUM1 As Integer NUM1 = Double.Parse(Strings.Right(模具開發單編碼_tb.Text, 8)) + 1 If NUM1 < 10 Then : 模具開發單編碼_tb.Text = "MD" & "0000000" & NUM1 ElseIf NUM1 > 9 And NUM1 < 100 Then : 模具開發單編碼_tb.Text = "MD" & "000000" & NUM1 ElseIf NUM1 > 99 And NUM1 < 1000 Then : 模具開發單編碼_tb.Text = "MD" & "00000" & NUM1 ElseIf NUM1 > 999 And NUM1 < 10000 Then : 模具開發單編碼_tb.Text = "MD" & "0000" & NUM1 ElseIf NUM1 > 9999 And NUM1 < 100000 Then : 模具開發單編碼_tb.Text = "MD" & "000" & NUM1 ElseIf NUM1 > 99999 And NUM1 < 100000 Then : 模具開發單編碼_tb.Text = "MD" & "00" & NUM1 ElseIf NUM1 > 999999 And NUM1 < 1000000 Then : 模具開發單編碼_tb.Text = "MD" & "0" & NUM1 ElseIf NUM1 > 9999999 Then : 模具開發單編碼_tb.Text = "MD" & NUM1 End If End Sub Private Sub Set_日期格式轉換() DTP = Strings.Format(Today(), "yyyy/MM/dd") End Sub Private Sub Button3_Click(sender As Object, e As EventArgs) Handles 儲存新增_bt.Click If 模具廠_cb.Text = "" Or 結構_cb.Text = "" Or 材質_cb.Text = "" Or 楦頭編號_cb.Text = "" Or 品牌_cb.Text = "" Or 大底廠_cb.Text = "" Or 季節_cb.Text = "" Or 模具開發單編碼_tb.Text = "" Or 模具編號_tb.Text = "" Or 參考漾鞋編號_tb.Text = "" Or 尺寸_tb.Text = "" Or 檔案名稱_tb.Text = "" Then MsgBox("資料不齊全,除了備註欄位其他位置不可空白,並請注意圖片是否有準備好。") Else SQL_模具開發控制表() If dr.Read() Then conn.Close() : MsgBox("資料重複,不予許新建") Else Dim 驗證 As String = "" : Dim 取變數 As String 取變數 = Strings.StrReverse(檔案名稱_tb.Text) For i As Integer = 1 To 10 If i = 1 Then 驗證 = Strings.Left(取變數, i) Else If Strings.Mid(取變數, i, 1) = "." Then 驗證 = Strings.StrReverse(驗證) : Exit For Else 驗證 &= Strings.Mid(取變數, i, 1) End If End If Next If 驗證 = "PNG" Or 驗證 = "png" Or 驗證 = "GIF" Or 驗證 = "gif" Or 驗證 = "BMP" Or 驗證 = "bmp" Or 驗證 = "JPG" Or 驗證 = "jpg" Or 驗證 = "JPEG" Or 驗證 = "jpeg" Then Set_日期格式轉換() SQL_查詢最後一筆模具開發單號() If dr.Read() Then conn.Close() SQL_最後一筆模具開發單號() If dr.Read() Then : 模具開發單編碼_tb.Text = dr("模具開發單號").ToString : Else : 模具開發單編碼_tb.Text = "MD00000000" : End If conn.Close() Dim NUM1 As Integer NUM1 = Double.Parse(Strings.Right(模具開發單編碼_tb.Text, 8)) + 1 If NUM1 < 10 Then : 模具開發單編碼_tb.Text = "MD" & "0000000" & NUM1 ElseIf NUM1 > 9 And NUM1 < 100 Then : 模具開發單編碼_tb.Text = "MD" & "000000" & NUM1 ElseIf NUM1 > 99 And NUM1 < 1000 Then : 模具開發單編碼_tb.Text = "MD" & "00000" & NUM1 ElseIf NUM1 > 999 And NUM1 < 10000 Then : 模具開發單編碼_tb.Text = "MD" & "0000" & NUM1 ElseIf NUM1 > 9999 And NUM1 < 100000 Then : 模具開發單編碼_tb.Text = "MD" & "000" & NUM1 ElseIf NUM1 > 99999 And NUM1 < 100000 Then : 模具開發單編碼_tb.Text = "MD" & "00" & NUM1 ElseIf NUM1 > 999999 And NUM1 < 1000000 Then : 模具開發單編碼_tb.Text = "MD" & "0" & NUM1 ElseIf NUM1 > 9999999 Then : 模具開發單編碼_tb.Text = "MD" & NUM1 End If PA49 = TextBox7.Text : SQL_新增模具開發控制表() Else PA49 = TextBox7.Text : SQL_新增模具開發控制表() End If conn.Close() 圖片導入() : Set_楦頭規格表清單() : MsgBox("新增完成") 模具廠_cb.Enabled = False : 結構_cb.Enabled = False : 材質_cb.Enabled = False : 楦頭編號_cb.Enabled = False : 品牌_cb.Enabled = False : 大底廠_cb.Enabled = False 季節_cb.Enabled = False : 模具編號_tb.Enabled = False : 參考漾鞋編號_tb.Enabled = False : 尺寸_tb.Enabled = False : 備註_tb.Enabled = False : 儲存新增_bt.Enabled = False 儲存修改_bt.Enabled = False : 新增_bt.Enabled = True : 修改_bt.Enabled = True : 檔案名稱_tb.Text = "" MsgBox("修改完成") : 檔案名稱_tb.Text = "" Else 檔案名稱_tb.Text = "" MsgBox("上傳文件並非常用圖片格式,文件已自動刪除,請專換成常用圖片檔案再行操作。") End If End If End If End Sub Private Sub Button5_Click(sender As Object, e As EventArgs) Handles 修改_bt.Click 模具廠_cb.Enabled = True : 結構_cb.Enabled = True : 材質_cb.Enabled = True : 楦頭編號_cb.Enabled = True : 品牌_cb.Enabled = True : 大底廠_cb.Enabled = True : 季節_cb.Enabled = True 模具編號_tb.Enabled = True : 參考漾鞋編號_tb.Enabled = True : 尺寸_tb.Enabled = True : 備註_tb.Enabled = True : 儲存新增_bt.Enabled = False : 儲存修改_bt.Enabled = True 新增_bt.Enabled = False : 修改_bt.Enabled = False End Sub Private Sub Button6_Click(sender As Object, e As EventArgs) Handles 儲存修改_bt.Click Set_日期格式轉換() SQL_修改模具開發控制表() conn.Close() Set_楦頭規格表清單() MsgBox("修改完成") 模具廠_cb.Enabled = False : 結構_cb.Enabled = False : 材質_cb.Enabled = False : 楦頭編號_cb.Enabled = False : 品牌_cb.Enabled = False : 大底廠_cb.Enabled = False : 季節_cb.Enabled = False 模具編號_tb.Enabled = False : 參考漾鞋編號_tb.Enabled = False : 尺寸_tb.Enabled = False : 備註_tb.Enabled = False : 儲存新增_bt.Enabled = False : 儲存修改_bt.Enabled = False 新增_bt.Enabled = True : 修改_bt.Enabled = True End Sub Private Sub TextBox5_DragEnter(sender As Object, e As DragEventArgs) Handles 檔案名稱_tb.DragEnter If e.Data.GetDataPresent(DataFormats.FileDrop) Then Dim files As String() Try files = CType(e.Data.GetData(DataFormats.FileDrop), String()) 檔案名稱_tb.Text = files(files.Length - 1) Catch ex As Exception MessageBox.Show(ex.Message) Return End Try End If Dim STR2 As Integer = 0 TextBox7.Text = 檔案名稱_tb.Text If 檔案名稱_tb.Text = "" Then Else For i As Integer = 0 To 9999 Dim STR1 As Integer = Strings.Len(TextBox7.Text) If Strings.Right((TextBox7.Text), 1) <> "\" Then STR1 -= 1 : STR2 += 1 If STR1 = 0 Then TextBox7.Text = "" 檔案名稱_tb.Text = "" i = 9999 Else TextBox7.Text = Strings.Left((TextBox7.Text), STR1) End If Else TextBox7.Text = Strings.Right((檔案名稱_tb.Text), STR2) 檔案名稱_tb.Text = TextBox7.Text i = 9999 End If Next Dim files As String() : files = CType(e.Data.GetData(DataFormats.FileDrop), String()) TextBox7.Text = files(files.Length - 1) End If End Sub Private Sub TextBox5_DragDrop(ByVal sender As Object, ByVal e As DragEventArgs) Handles 檔案名稱_tb.DragDrop Dim files As Array = e.Data.GetData(DataFormats.FileDrop) For Each file As String In files 檔案名稱_tb.AppendText(file + Environment.NewLine) Next End Sub Private Sub Button4_Click(sender As Object, e As EventArgs) Handles 讀取料夾路徑_bt.Click If FolderBrowserDialog1.ShowDialog = DialogResult.OK Then WebBrowser2.Navigate(FolderBrowserDialog1.SelectedPath) End If End Sub Private Sub Button24_Click(sender As Object, e As EventArgs) Handles 圖片修改存檔_bt.Click If 模具開發單編碼_tb.Text = "" Or 檔案名稱_tb.Text = "" Then : MsgBox("請確定需要修改圖片的模具資料已選擇與圖片資料已準備完畢。") : Else Dim 驗證 As String = "" : Dim 取變數 As String : Dim frq As FtpWebRequest, frp As FtpWebResponse, fcr As NetworkCredential : 取變數 = Strings.StrReverse(檔案名稱_tb.Text) For i As Integer = 1 To 10 If i = 1 Then : 驗證 = Strings.Left(取變數, i) : Else If Strings.Mid(取變數, i, 1) = "." Then : 驗證 = Strings.StrReverse(驗證) : Exit For : Else : 驗證 &= Strings.Mid(取變數, i, 1) : End If End If Next If 驗證 = "PNG" Or 驗證 = "png" Or 驗證 = "GIF" Or 驗證 = "gif" Or 驗證 = "BMP" Or 驗證 = "bmp" Or 驗證 = "JPG" Or 驗證 = "jpg" Or 驗證 = "JPEG" Or 驗證 = "jpeg" Then Set_日期格式轉換() PA49 = TextBox7.Text : SQL_修改模具開發控制表1() conn.Close() : dr.Close() 檔案名稱_tb.Text = "" : 圖片導入() : MsgBox("修改完成") Else : MsgBox("上傳文件並非常用圖片格式,文件已自動刪除,請專換成常用圖片檔案再行操作。") : End If End If End Sub Private Sub Button8_Click(sender As Object, e As EventArgs) Handles 列印_bt.Click xlApp = CType(CreateObject("Excel.Application"), Microsoft.Office.Interop.Excel.Application) xlBook = xlApp.Workbooks.Add xlApp.DisplayAlerts = True xlBook.Activate() xlSheet = NewMethod(xlBook) xlSheet.Activate() xlApp.Visible = True xlApp.Application.WindowState = xlMaximized xlSheet.Cells(1, 1) = "巨益模具開發計畫表" : xlSheet.Cells(2, 1) = "模具廠 : " : xlSheet.Cells(3, 1) = "結構 : " : xlSheet.Cells(4, 1) = "材質 : " : xlSheet.Cells(5, 1) = "楦頭編號 : " xlSheet.Cells(6, 1) = "模具編號 : " : xlSheet.Cells(2, 2) = 模具廠_cb.Text : xlSheet.Cells(3, 2) = 結構_cb.Text : xlSheet.Cells(4, 2) = 材質_cb.Text : xlSheet.Cells(5, 2) = 楦頭編號_cb.Text xlSheet.Cells(6, 2) = 模具編號_tb.Text : xlSheet.Cells(2, 3) = "參考漾鞋編號 : " : xlSheet.Cells(3, 3) = "品牌 : " : xlSheet.Cells(4, 3) = "大底廠 : " : xlSheet.Cells(5, 3) = "尺寸 : " xlSheet.Cells(6, 3) = "季節 : " : xlSheet.Cells(2, 4) = 模具編號_tb.Text : xlSheet.Cells(3, 4) = 品牌_cb.Text : xlSheet.Cells(4, 4) = 大底廠_cb.Text : xlSheet.Cells(5, 4) = 尺寸_tb.Text xlSheet.Cells(6, 4) = 季節_cb.Text : xlSheet.Cells(7, 4) = "備註 : " : xlSheet.Cells(8, 4) = 備註_tb.Text : xlSheet.Cells(52, 1) = "製表人 : " : xlSheet.Cells(52, 2) = TextBox8.Text xlSheet.Cells(52, 3) = "製表人 : " : xlSheet.Cells(52, 4) = TextBox9.Text CC(xlApp, xlSheet) : BB(xlApp, xlSheet) xlSheet.PageSetup.PrintArea = "" xlApp.Cells.Select() xlSheet.Range("B1").Select() xlApp.Application.WindowState = xlMinimized MsgBox("列印完成") End Sub Private Shared Function NewMethod(xlBook As Microsoft.Office.Interop.Excel.Workbook) As Microsoft.Office.Interop.Excel.Worksheet Return CType(xlBook.Worksheets.Add, Microsoft.Office.Interop.Excel.Worksheet) End Function Private Sub CC(ByVal myExcel As Application, ByVal xlSheet As Worksheet) xlSheet.Cells.Select() With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 12 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 15 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 50 xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 15 : xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 40 xlSheet.Rows("2:6").Select : myExcel.Selection.RowHeight = 30 : xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 35 xlSheet.Range("D8:D51").Select() : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("A2:D6").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With xlSheet.Range("A7:C51").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("D7:D51").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Rows("8:8").Select : myExcel.Selection.RowHeight = 15.75 xlSheet.Range("A1:D1").Select() : myExcel.Selection.Merge With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 26 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With myExcel.ActiveWindow.DisplayGridlines = False myExcel.Application.PrintCommunication = False With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "" : .PrintTitleColumns = "" : End With myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "" : myExcel.Application.PrintCommunication = False With myExcel.ActiveSheet.PageSetup : .LeftHeader = "" : .CenterHeader = "" : .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "" : .RightFooter = "" .LeftMargin = myExcel.Application.InchesToPoints(0.236220472440945) : .RightMargin = myExcel.Application.InchesToPoints(0.236220472440945) .TopMargin = myExcel.Application.InchesToPoints(0.748031496062992) : .BottomMargin = myExcel.Application.InchesToPoints(0.748031496062992) .HeaderMargin = myExcel.Application.InchesToPoints(0.31496062992126) : .FooterMargin = myExcel.Application.InchesToPoints(0.31496062992126) .PrintHeadings = False : .PrintGridlines = False : .PrintQuality = 600 : .CenterHorizontally = True : .CenterVertically = True : .Draft = False : .FirstPageNumber = xlAutomatic .BlackAndWhite = False : .Zoom = False : .FitToPagesWide = 1 : .FitToPagesTall = 1 : .OddAndEvenPagesHeaderFooter = False : .DifferentFirstPageHeaderFooter = False .ScaleWithDocHeaderFooter = True : .AlignMarginsHeaderFooter = True : .EvenPage.LeftHeader.Text = "" : .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = "" .EvenPage.LeftFooter.Text = "" : .EvenPage.CenterFooter.Text = "" : .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = "" : .FirstPage.CenterHeader.Text = "" .FirstPage.RightHeader.Text = "" : .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = "" : .FirstPage.RightFooter.Text = "" End With myExcel.Application.PrintCommunication = False End Sub Private Sub BB(ByVal myExcel As Application, ByVal xlSheet As Worksheet) Clipboard.SetDataObject(PictureBox1.Image) xlSheet.Range("A7").Select() myExcel.ActiveSheet.Pictures.Paste.Select myExcel.Selection.ShapeRange.Width = 485 myExcel.Selection.ShapeRange.IncrementLeft(3) myExcel.Selection.ShapeRange.IncrementTop(3) End Sub Private Sub Button11_Click(sender As Object, e As EventArgs) Handles 新增模具廠_bt.Click PA = "" : 供應商管理_製鞋樣品.Show() : 供應商管理_製鞋樣品.BringToFront() End Sub Private Sub Button13_Click(sender As Object, e As EventArgs) Handles 新增大底廠_bt.Click PA = "" : 供應商管理_製鞋樣品.Show() : 供應商管理_製鞋樣品.BringToFront() End Sub Private Sub Button12_Click(sender As Object, e As EventArgs) Handles 新增楦頭編號_bt.Click PA = "" : 楦頭規格表.Show() : 楦頭規格表.BringToFront() End Sub Private Sub Button10_Click(sender As Object, e As EventArgs) Handles 新增季節清單_bt.Click 清單修改.Close() : 季節清單修改 = True : 清單修改.ShowDialog() : ComboBox7下拉表單資料載入() : 季節清單修改 = False End Sub Private Sub Button18_Click(sender As Object, e As EventArgs) Handles 新增結構清單_bt.Click 清單修改.Close() : 模具用結構 = True : 清單修改.ShowDialog() : ComboBox2下拉表單資料載入() : 模具用結構 = False End Sub Private Sub Button9_Click(sender As Object, e As EventArgs) Handles 新增材質清單_bt.Click 清單修改.Close() : 模具用材質 = True : 清單修改.ShowDialog() : ComboBox3下拉表單資料載入() : 模具用材質 = False End Sub End Class