- ©«¤l
- 109
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 114
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7 Win10
- ³nÅ骩¥»
- Office 2019 WPS
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ²`¦`
- µù¥U®É¶¡
- 2013-2-2
- ³Ì«áµn¿ý
- 2024-11-6
|
¥»©«³Ì«á¥Ñ Joforn ©ó 2020-12-1 20:03 ½s¿è
¥ý¤W´ú¸Õ¥N½X¡G- Sub TestSaveRangeToPictrue()
- Dim PathName As String
- Dim FileNames() As String
- Dim FileName As String
- Dim I As Long
-
-
- Debug.Print "=============¶}©l´ú¸Õ¤å¥ó¿é¥X==================="
- PathName = ThisWorkbook.Path & Application.PathSeparator
-
- FileNames = Split("WMF,EMF,PDF,XPS", ",")
- For I = 0 To UBound(FileNames)
- FileName = PathName & "SaveRangeTo" & FileNames(I) & "(¥Ú¶q)." & FileNames(I)
- Debug.Print "[" & IIf(SaveRangeToPictrue(Range("L1:R21"), FileName), "¦¨¥\", "¥¢±Ñ") & "]¡G«O¦s" & FileNames(I) & "¤å¥ó""" & FileName & """"
- FileName = PathName & "Pictures.ZIP>¥Ú¶q\SaveRangeTo" & FileNames(I) & "." & FileNames(I)
- Debug.Print "[" & IIf(SaveRangeToPictrue(Range("L1:R21"), FileName), "¦¨¥\", "¥¢±Ñ") & "]¡G²K¥[" & FileNames(I) & "¤å¥ó¨ì""Pictures. ZIP"""
- Next
-
- FileNames = Split("BMP,PNG,ICO,JPG,TIF,TGA,SVG,GIF", ",")
- For I = 0 To UBound(FileNames)
- FileName = PathName & "SaveRangeTo" & FileNames(I) & "(µL³z©ú)." & FileNames(I)
- Debug.Print "[" & IIf(SaveRangeToPictrue(Range("L1:R21"), FileName), "¦¨¥\", "¥¢±Ñ") & "]¡G«O¦s" & FileNames(I) & "¤å¥ó""" & FileName & """"
- FileName = PathName & "Pictures.ZIP>µL³z©ú\SaveRangeTo" & FileNames(I) & "." & FileNames(I)
- Debug.Print "[" & IIf(SaveRangeToPictrue(Range("L1:R21"), FileName), "¦¨¥\", "¥¢±Ñ") & "]¡G²K¥[" & FileNames(I) & "¹Ï¤ù¨ì""Pictures. ZIP"""
- Next
-
- FileNames = Split("PNG,ICO,TGA,SVG", ",")
- For I = 0 To UBound(FileNames)
- FileName = PathName & "SaveRangeTo" & FileNames(I) & "(I´º¥þ³z)." & FileNames(I)
- Debug.Print "[" & IIf(SaveRangeToPictrue(Range("L1:R21"), FileName, -1), "¦¨¥\", "¥¢±Ñ") & "]¡G«O¦s" & FileNames(I) & "¤å¥ó"" " & FileName & """"
- FileName = PathName & "Pictures.ZIP>³z©ú\I´º¥þ³z\SaveRangeTo" & FileNames(I) & "." & FileNames(I)
- Debug.Print "[" & IIf(SaveRangeToPictrue(Range("L1:R21"), FileName, -1), "¦¨¥\", "¥¢±Ñ") & "]¡G²K¥[" & FileNames(I) & "I´º¥þ³z©ú¹Ï¤ù¨ì""Pictures.ZIP"""
- FileName = PathName & "SaveRangeTo" & FileNames(I) & "(I´º¥b³z)." & FileNames(I)
- Debug.Print "[" & IIf(SaveRangeToPictrue(Range("L1:R21"), FileName, -1, 128), "¦¨¥\", "¥¢±Ñ") & "]¡G«O¦s" & FileNames(I) & "¤å¥ó""" & FileName & """"
- FileName = PathName & "Pictures.ZIP>³z©ú\I´º¥b³z\SaveRangeTo" & FileNames(I) & "." & FileNames(I)
- Debug.Print "[" & IIf(SaveRangeToPictrue(Range("L1:R21"), FileName, -1, 128), "¦¨¥\", "¥¢±Ñ") & "]¡G²K¥[" & FileNames(I) & "I´º¥b³z©ú¹Ï¤ù¨ì""Pictures.ZIP"""
- FileName = PathName & "SaveRangeTo" & FileNames(I) & "(¾ãÅé¥b³z)." & FileNames(I)
- Debug.Print "[" & IIf(SaveRangeToPictrue(Range("L1:R21"), FileName, -2, 128), "¦¨¥\", "¥¢±Ñ") & "]¡G«O¦s" & FileNames(I) & "¤å¥ó""" & FileName & """"
- FileName = PathName & "Pictures.ZIP>³z©ú\¾ãÅé¥b³z\SaveRangeTo" & FileNames(I) & "." & FileNames(I)
- Debug.Print "[" & IIf(SaveRangeToPictrue(Range("L1:R21"), FileName, -2, 128), "¦¨¥\", "¥¢±Ñ") & "]¡G²K¥[" & FileNames(I) & "¾ãÅé¥b³z©ú¹Ï¤ù¨ì""Pictures.ZIP"""
- Next
- Debug.Print "=============¡@¡@´ú¸Õµ²§ô¡@¡@==================="
- End Sub
- Sub TestSaveImageMso()
- Dim PathName As String
- Dim FileNames() As String
- Dim FileName As String
- Dim I As Long
-
- On Error Resume Next
-
- PathName = ThisWorkbook.Path & Application.PathSeparator
- FileNames = Split("About,AccessRecycleBin,BlogHomePage,ClearGrid,Folder", ",")
- For I = 0 To UBound(FileNames)
- FileName = PathName & FileNames(I)
- With CommandBars.GetImageMso(FileNames(I), 32, 32)
- Debug.Print "[" & IIf(SaveBitmapToFile(.Handle, FileName & ".PNG", &HFFFFFF), "¦¨¥\", "¥¢±Ñ") & "]¡G«O¦s""" & FileNames(I) & """¹Ï¼Ð¨ì¤å¥ó""" & FileName & ".PNG""¤å¥ó"
- Debug.Print "[" & IIf(SaveBitmapToFile(.Handle, FileName & ".ICO", &HFFFFFF, , 32), "¦¨¥\", "¥¢±Ñ") & "]¡G«O¦s""" & FileNames(I) & " ""¹Ï¼Ð¨ì¤å¥ó""" & FileName & ".ICO""¤å¥ó"
- End With
- Next
- End Sub
½Æ»s¥N½X
´ú¸Õ®ÄªG(¥»¼Ò²Õ¤w§¹¬ü³q¹LXP+Office2007¡BWin7+Office2010(64¦ì)¡BWin7+Office2007(32¦ì)¡BWin10+Office2019(64¦ì)´ú¸Õ)¡G
¥»¼Ò¶ô¤ä«ù¥Í¦¨ªº¤å¥ó®æ¦¡¡G
1¡BBMP¹Ï¤ù®æ¦¡¡G32¦ì¦ì¹Ï¤å¥ó ¡A¤£¤ä«ù³z©ú¡F
2¡BPNG¹Ï¤ù®æ¦¡¡G¥Í¦¨32¦ì±a³z©ú³q¹DµL·lÀ£ÁY¹Ï¤ù¡F
3¡BICO¹Ï¤ù®æ¦¡¡G¥Í¦¨Windows XP³z©ú¹Ï¼Ð¡]ª`¡GVBAµ¡Å餤¥i¯à¤£¯àª½±µ¨Ï¥Î¡A¤£³QVBA¤ä«ù¡^¡Anª`·Nªº¬O¡A¦pªG¨S¦³¬°¹Ï¼Ð¹ïÀ³«ü©w¤Ø¤o¡A¨º¤\¥Í¦¨ªº¹Ï¼Ð©MRange°Ï°ì¤j¤p¬Û¦P¡A¤]´N¬O»¡¥Í¦¨ªº¹Ï¼Ð¨Ã¤£¬O±`¨£32¡Ñ32©Î256¡Ñ256¤§Ãþªº¥¿¤è«¬¹Ï¼Ð¡F
4¡BTGA¹Ï¤ù®æ¦¡¡G¥Í¦¨32¦ì±a³z©ú³q¹DlwzµL·lÀ£ÁYªºTGA¹Ï¤ù¡A¥Ñ©óTGA¹Ï¤ù¥i³QOpenGLª½±µ½Õ¥Î°µ¬°3D¶K¹Ï¡A¬G¦Ó±`¨£©ó¤Q¦h¦~«eªº¦Ñ¹CÀ¸¯À§÷¤¤¡A¦ý¬Onª`·Nªº¬O¦pªG¨Ï¥ÎPS¥´¶}TGA¤å¥óªº¸Ü¡APS·|©¿²¤±¼³z©ú³q¹D¡]¥]¬APS¦Û¤v¥Í¦¨ªº³z©úTGA¹Ï¡^¡A¦ý¨ä¥¦³n¥ó¥¿±`¡F
5¡BJPG/JPEG¹Ï¤ù®æ¦¡¡G³Ì±`¨£ªº¦³·lÀ£ÁY¹Ï¤ù®æ¦¡¡A¤£¤ä«ù³z©ú¡F
6¡BTIFF¹Ï¤ù®æ¦¡¡G¤£¤ä«ù³z©ú
7¡BGIF¹Ï¤ù®æ¦¡¡G¤£¤ä«ùI´º³z©úªºGIF¹Ï¤ù®æ¦¡¡]ª`·N¡GGIF®æ¦¡¥»¨¬O¤ä«ù³z©úªº¡A¦ý¥»¤H°½Ãi¡A¨S¥h¥Ñ¦Û¤v¥Í¦¨¤G¶i¨îªºGIF¤å¥ó¡A©Ò¥H¥»¼Ò¶ô«O¦sªºGIF¤å¥ó¤£¤ä«ùI´º³z©ú¡^¡F
8¡BSVG¹Ï¤ù®æ¦¡: ¥Ú¶q¹Ï¡A¥i¥H¨Ï¥Î¥D¬yºô¶ÂsÄý¾¹ª½±µ¥´¶}¬d¬Ý¨ÇÃþ¹Ï¤ù¡C
9¡BWMF¹Ï¤ù®æ¦¡¡G¥Ú¶q¹Ï
10¡BEMF¹Ï¤ù®æ¦¡¡G¥Ú¶q¹Ï
11¡BPDF¤å¥ó®æ¦¡¡G
12¡BXPS¤å¥ó®æ¦¡¡G«Øij¨Ï¥ÎXPS Viewer¬d¬Ý(Win10¦Û±a¡A¦ý»Ý¤â°Ê¦b²Õ¥ó¤¤²K¥[)
13¡BZIP¤å¥ó®æ¦¡¡G³o³f¥u¬O¬°¤FÀ°§U§Ú̧â¤W±¥Í¦¨ªº¤å¥ó¥´¥]¦¨¤@Ó¤å¥ó¡Cª½±µ½Õ¥ÎShell32¥Í¦¨¡AµL»Ý²Ä¤T¤èDLL¤ä«ù¡C
·½½X¦b³o¸Ì¡G
SaveRangeToPictrue.zip (163.49 KB)
¦pªG¥u»Ýn¥Î¨ì¸Ì±ªº¥\¯àªº¸Ü¡A¥i¥H¶È¶È¾É¥XbasSaveRangeToPictrue¼Ò²Õ¨ì¨ä¥¦ªºVBA±M®×¤¤¡A¨Ì·Ó¤W±ªº´ú¸Õ¥N½X¤¤ªº¤è¦¡½Õ¥ÎSaveRangeToPictrue¨ç¼Æ´NOK¤F¡A¼Ò²Õ¤¤ÁÙ¦³SaveClipboardToPictrue¡BSaveBitmapToFile¨âÓ¨ç¼Æ¡A¥ç¥i°Ñ·Óì¥N½X¤¤ªº®æ¦¡©M»¡©úµ²¦X¦Û¤vªº¹ê»Ú»Ý¨D½Õ¥Î¡C¤ñ¦p¡G¦pªG·Q±NExcel¤¤ªºRibbon¹Ï¼Ð¾É¥X¬°ICO¤åÀɩάOPNG¤åÀÉ¡A¶È»Ý¨Ì·ÓTestSaveImageMso¤¤ªº¤èªk§Y¥i¾É¥X¨ìºÏºÐ¤¤¡C |
|