advanced help
per page, with , order by , clip by
Results of 1 - 1 of about 295 for cell filename (0.001 sec.)
cell (1170), filename (1981)
[[20050803123003]]
#score: 11170
@digest: 7ab10728b10ea3075fdc77e0f3c43866
@id: 15952
@mdate: 2005-08-04T07:48:58Z
@size: 4756
@type: text/plain
#keywords: filenum (31788), destfile (29755), iteration (15368), checking (14536), rowcount (13963), mytime (12648), kosin (7684), columncount (7282), quotation (6466), otherwise (6347), saved (4715), ontime (4600), timevalue (3860), write (3731), 動保 (2892), current (2887), ト出 (2404), destination (1953), auto (1710), saveas (1611), selection (1525), thisworkbook (1493), createbackup (1417), filename (1274), file (1098), fileformat (921), ファ (872), start (870), application (817), 保存 (793), 読め (760), print (736)
『CSV形式での自動保存』(けろ)
あるエクセルファイルをCSV形式で別ファイルに5秒ごとに自動保存したいのですが、うまくできません。 エクセルを開いたままの状態でも他のパソコンからCSVファイルを読めるようにしたいのですが どうしたらいいでしょうか? わかる方いらっしゃいましたらよろしくお願いします ---- >うまくできません。 どのように試して、どのように上手く行かないのか説明をお願い致します。 >エクセルを開いたままの状態でも他のパソコンから >CSVファイルを読めるようにしたいのですがどうしたらいいでしょうか これは意味が分からないです。 もっと詳しく具体的に説明をお願い致します。 (INA) ----- 抽象的な書き方ですみませんでした。過去ログをみながら Sub auto_open() myTime = Now + TimeValue("00:00:05") Application.OnTime myTime, "test" End Sub Sub auto_close() Application.OnTime myTime, "test", , False End Sub Sub test() ThisWorkbook.SaveAs Filename:= _ 〜〜 .csv", FileFormat:=xlCSV _, CreateBackup:=False myTime = Now + TimeValue("00:00:05") Application.OnTime myTime, "test" End Sub のようにマクロに入力しました。最初は入力ミスがあったようで、 やり直しましたら5秒置きにファイルを置き換えますかと聞かれるようになりました。 とりあえず疑問は解決しました。ご迷惑をおかけしました。 あと、置き換えますかと聞かずに勝手に置き換えていってくれる方法がもしあれば ご教授くださいませ (けろ) ---- ThisWorkbook.saved = true を追加してみてください。 savedプロパティの意味はヘルプを読んでください。 (INA) ---- 早速のご解答ありがとうございます。 ThisWorkbook.SaveAs Filenameの上の行に ThisWorkbook.Saved = true を入れてやってみたのですが、やはり置き換えますか?という ダイアログが出てきます。もう少しやってみます。 ---- saveasメソッドを使わないで直接、テキスト出力した方が良いかもしれません。 [[20040909150950]] (INA) ---- いろいろありがとうございます。 SaveAsの代わりに以下のテキスト出力マクロを入れてみました。 これは5秒ごとにファイル名パス名を入力、保存する方式になっています。 たびたびですみませんが、保存するたびにファイル名を 指定しなくてもよくするにはどうすればよろしいでしょうか。 Sub auto_open() myTime = Now + TimeValue("00:00:05") Application.OnTime myTime, "test" End Sub Sub auto_close() Application.OnTime myTime, "test", , False End Sub Sub test() ' Dimension all variables. Dim DestFile As String Dim FileNum As Integer Dim ColumnCount As Integer Dim RowCount As Integer ' Prompt user for destination file name. DestFile = InputBox("Enter the destination filename" _ & Chr(10) & "(with complete path):", "Quote-Comma Exporter") FileNum = FreeFile() ' Turn error checking off. On Error Resume Next ' Attempt to open destination file for output. Open DestFile For Output As #FileNum ' If an error occurs report it and end. If Err <> 0 Then MsgBox "Cannot open filename " & DestFile End End If ' Turn error checking on. On Error GoTo 0 ' Loop for each row in selection. For RowCount = 1 To Selection.Rows.Count ' Loop for each column in selection. For ColumnCount = 1 To Selection.Columns.Count ' Write current cell's text to file with quotation marks. Print #FileNum, """" & Selection.Cells(RowCount, _ ColumnCount).Text & """"; ' Check if cell is in last column. If ColumnCount = Selection.Columns.Count Then ' If so, then write a blank line. Print #FileNum, Else ' Otherwise, write a comma. Print #FileNum, ","; End If ' Start next iteration of ColumnCount loop. Next ColumnCount ' Start next iteration of RowCount loop. Next RowCount ' Close destination file. Close #FileNum ThisWorkbook.Saved = True myTime = Now + TimeValue("00:00:05") Application.OnTime myTime, "test" End Sub ---- Sub kosin() If ThisWorkbook.Path <> "" Then Range("B2:G9").Select Selection.Copy Windows("hozon.csv").Activate Range("B2").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Windows("test.xls").Activate ThisWorkbook.Saved = True End If Application.OnTime Time() + TimeValue("00:00:05"), "kosin" End Sub CSV形式で保存するところは、形式を選択して値の貼付けを使いマクロに保存しました。 hozon.csvファイルをたちあげていないといけませんがとりあえず解決しました。 INAさんありがとうございました。 ...
http://www.excel.studio-kazu.jp/wiki/kazuwiki/200508/20050803123003.txt - [detail] - similar
PREV NEXT
Powered by Hyper Estraier 1.4.13, with 97013 documents and 608132 words.

訪問者:カウンタValid HTML 4.01 Transitional