广告广告
  加入我的最爱 设为首页 风格修改
首页 首尾
 手机版   订阅   地图  繁体 
您是第 13976 个阅读者
 
发表文章 发表投票 回覆文章
  可列印版   加为IE收藏   收藏主题   上一主题 | 下一主题   
jay927 手机
数位造型
个人文章 个人相簿 个人日记 个人地图
小人物
级别: 小人物 该用户目前不上站
推文 x0 鲜花 x7
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片
推文 x0
EXCEL VBA 另存新档的问题
1.请问要怎样让运算完成的EXCEL报表直接自动另存新档?
2 ..

访客只能看到部份内容,免费 加入会员 或由脸书 Google 可以看到全部内容



献花 x0 回到顶端 [楼 主] From:台湾中华电信 | Posted:2006-03-10 17:02 |
circlemap
数位造型
个人文章 个人相簿 个人日记 个人地图
小人物
级别: 小人物 该用户目前不上站
推文 x0 鲜花 x53
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

Option Explicit
Const FolderPath As String = "C:\tmp\"


Sub eee()

Dim strDay As String
Dim strMonth As String
Dim strYear As String

strDay = Day(Now)
strMonth = Month(Now)
strYear = Year(Now)

If Val(strDay) < 10 Then
strDay = "0" & strDay
End If

If Val(strMonth) < 10 Then
strMonth = "0" & strMonth
End If

strYear = Right(strYear, 2)


Application.DisplayAlerts = False

ThisWorkbook.SaveAs (FolderPath & strDay & strMonth & strYear)

Application.DisplayAlerts = True

End Sub

稍微写了一下   不过 你要有 C:\tmp\ 这个资料夹存在,或者你改
Const FolderPath As String = "C:\tmp\" 这一句成为你要的资料夹


献花 x0 回到顶端 [1 楼] From:台湾中华电信 | Posted:2006-03-10 17:44 |
jay927 手机
数位造型
个人文章 个人相簿 个人日记 个人地图
小人物
级别: 小人物 该用户目前不上站
推文 x0 鲜花 x7
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

感谢大大!
存档的部分完成了!
不过另外的问题又出现!
新存的档案连巨集也一起存进去里面!
能够做到新存的档案里面只有资料,不把巨集也存进去吗?


献花 x0 回到顶端 [2 楼] From:台湾亚太线上 | Posted:2006-03-11 00:49 |
iwinblue
数位造型
个人文章 个人相簿 个人日记 个人地图
路人甲
级别: 路人甲 该用户目前不上站
推文 x0 鲜花 x0
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

请问依下这个地方哪里有错,我看不出来,请大家帮我依下,感恩
储存的档案,叫不出来
以下所以的条件
排序,再另存新档

Option Explicit
Const FolderPath As String = "C:\tmp\"
Sub eee()

  Cells.Select
  Selection.Sort Key1:=Range("C2"), Order1:=xlAscending, Key2:=Range("B2") _
    , Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
    False, Orientation:=xlTopToBottom, SortMethod:=xlStroke, DataOption1:= _
    xlSortNormal, DataOption2:=xlSortNormal
  Range("H7").Select
  Columns("I:I").ColumnWidth = 11.75
  Columns("I:I").ColumnWidth = 14






Dim strYear As String
Dim strMonth As String
Dim strDay As String

strYear = Year(Now)
strMonth = Month(Now)
strDay = Day(Now)

strYear = Right(strYear, 2)

If Val(strMonth) < 10 Then
strMonth = "0" & strMonth
End If

If Val(strDay) < 10 Then
strDay = "0" & strDay
End If


Application.DisplayAlerts = False

ThisWorkbook.SaveAs (FolderPath & strYear & strMonth & strDay)

Application.DisplayAlerts = True

End Sub


献花 x0 回到顶端 [3 楼] From:APNIC | Posted:2009-04-23 18:51 |
lmz
数位造型
个人文章 个人相簿 个人日记 个人地图
路人甲
级别: 路人甲 该用户目前不上站
推文 x0 鲜花 x0
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

用巨集录制如下
  Cells.Select
  Selection.Sort Key1:=Range("C2")、Order1:=xlAscending、Key2:=Range("B2") _
    、Order2:=xlAscending、Header:=xlYes、OrderCustom:=1、MatchCase:=False _
    、Orientation:=xlTopToBottom、SortMethod:=xlPinYin、DataOption1:= _
    xlSortNormal、DataOption2:=xlSortNormal
.
.
Columns("I:I").ColumnWidth = 11.75......此段可以删除
Columns("I:I").ColumnWidth = 14

If Val(strMonth) < 10 Then
strMonth = "0" & strMonth
End If

可以改为

strMonth = WorksheetFunction.Text(strMonth, "00")


[ 此文章被lmz在2009-06-06 00:17重新编辑 ]


献花 x0 回到顶端 [4 楼] From:台湾数位联合 | Posted:2009-06-06 00:08 |

首页  发表文章 发表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.022868 second(s),query:16 Gzip disabled
本站由 瀛睿律师事务所 担任常年法律顾问 | 免责声明 | 本网站已依台湾网站内容分级规定处理 | 连络我们 | 访客留言