I recorded the macro below to open data from a text file, but I need to be able to select a different filename every time it runs. How can I add a file selection dialog to the following code that will allow me to select something other than the file 0125-FEA-I-S_reduced_input.t...
GetOpenFilename("新表,*.xlsx,老表,*.xls", 1, "快特么选!", "确定", False) Dialogs(对话框) 代码语言:javascript 代码运行次数:0 运行 AI代码解释 '对话框中所做的操作会真实执行,具体的值见附表 Application.Dialogs(xlDialogSaveAs).Show Application.Dialogs(150).Show 使用ADO操作外部数据 使用ADO...
代码语言:vba 复制 Sub RangeSelectionDialog() Dim rng As Range ' 显示范围选择对话框 Set rng = Application.InputBox("请选择一个范围", Type:=8) ' 处理选择的范围 If Not rng Is Nothing Then MsgBox "您选择的范围是: " & rng.Address Else MsgBox "您没有选择任何范围" End If End Sub ...
Sub highlightValue() Dim myStr As String Dim myRg As range Dim myTxt As String Dim myCell As range Dim myChar As String Dim I As Long Dim J As Long On Error Resume Next If ActiveWindow.RangeSelection.Count > 1 Then myTxt = ActiveWindow.RangeSelection.AddressLocal Else myTxt = ActiveShee...
Selection.Paste32 Selection.InsertBreak3334 word_temp.Close wdDoNotSaveChanges35Next3637 Application.ScreenUpdating = True38EndIf39EndWith4041Set word_result = Nothing42Set word_temp = Nothing43Set file_dialog = Nothing4445 str = Format(Timer - time_start, "均已成功合并;共用时0秒...
mb.SaveAs Filename:="D:\laoshi.xlsx"'保存工作簿 Cells.Find(what:="哈哈").Activate Selection.EntireRow.Delete '删除行 ' Selection.EntireColumn.Delete '删除列 Loop Until Cells.Find(what:="哈哈") Is Nothing sheets("用户名密码").Visible = xlVeryHidden'深度隐藏指定工作表 ...
'把语句中相同的部分提到前面WithSelection.Font'字体.Name ="华文琥珀"'字号.Size =9EndWith sub语句 实现一个功能 private sub私有,本模块才能调用 public sub公有,默认 Subtest(strasString) Range("A1") =100EndSub 调用语句 调用其他程序Subtest1()CalltestEndSub ...
DimMyDialogAsFileDialog OnErrorResumeNext Application.ScreenUpdating =False SetMyDialog = Application.FileDialog(msoFileDialogFilePicker) WithMyDialog ' .InitialFileName = "C:\" .Filters.Clear'清除所有文件筛选器中的项目 .Filters.Add"所有 WORD 文件","*.doc", 1'增加筛选器的项目为所有WORD文件 ...
9、tylexlDialogDefineStylexlDialogDeleteFormatxlDialogDeleteNamexlDialogDemotexlDialogDisplayxlDialogDisplayxlDialogEditboxPropertiesxlDialogEditColorxlDialogEditDeletexlDialogEditionOptionsxlDialogEditSeriesxlDialogErrorbarXxlDialogErrorbarYxlDialogExternalDataPropertiesxlDialogExtractxlDialogFileDele 10、texlDialogFile...
pen FileName:=C:My DocumentsBook2.xls关闭当前工作簿ActiveWindow.Close当前单元格定为:左对齐Selection.HorizontalAlignment = xlLeft当前单元格定为:中心对齐Selection.HorizontalAlignment = xlCenter当前单元格定为:右对齐Selection.HorizontalAlignment = xlRight当前单元格为百分号风格Selection.Style = P ercent当前单元...