Ask Question Forum:
Model Library:2025-02-08 Updated:A.I. model is online for auto reply question page
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by duncanb7
at 2024-07-22 03:49:06
Point:500 Replies:11 POST_ID:829068USER_ID:11059
Topic:
Microsoft Visual Basic.Net;Microsoft Excel Spreadsheet Software;Visual Basic Programming
I have three questions
question-1 I am using Excel 2007 VBA to do marco as follows for open FIle Diaglog box
and set the file path at C: emp*.* but it just open the file Diag and *.* is
put at the file inputbox,but I can Not see all file from *.*, Why?
Question-2 What it is different the program filediag code for VBA and VB.NET or Same or
Just smal change ? Could you provide it ?
Question-3 How could I change directory on FileDiag and if using .InitialFileName, it will
show the last slash string in the filename box around bottom of FileDiag box. Why ?
Duncan
question-1 I am using Excel 2007 VBA to do marco as follows for open FIle Diaglog box
and set the file path at C: emp*.* but it just open the file Diag and *.* is
put at the file inputbox,but I can Not see all file from *.*, Why?
Question-2 What it is different the program filediag code for VBA and VB.NET or Same or
Just smal change ? Could you provide it ?
Question-3 How could I change directory on FileDiag and if using .InitialFileName, it will
show the last slash string in the filename box around bottom of FileDiag box. Why ?
Duncan
Sub FileDiag() Dim strFileSelected As String Dim objOfficeDialog As Object Dim wbDestination As Workbook Dim wbSource As Workbook Dim sh As Worksheet Dim res As String Application.DisplayAlerts = False Application.EnableEvents = False Application.ScreenUpdating = False Set objOfficeDialog = Application.FileDialog(msoFileDialogFilePicker) Set wbDestination = ActiveWorkbookApplication.FileDialog(msoFileDialogFolderPicker _ ).InitialFileName = "C:Temp*.*" ' res = "Q:DebtInputs" & Format(Date, "yyyy") & "" & Format(Date, "yyyy") & Format(DateAdd("m", -1, Date), "mm") & "Reporting" 'Debug.Print res With objOfficeDialog ' .Title = "Select the Project Cost Allocation file" ' .AllowMultiSelect = False '.InitialFileName = res .ShowEnd With Application.DisplayAlerts = True Application.EnableEvents = True Application.ScreenUpdating = True Exit SubEnd Sub 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:20:21:22:23:24:25:26:27:28:29:30:31:
Author: duncanb7 replied at 2024-07-22 06:22:36
Thanks for all your reply
Duncan
Duncan
Assisted Solution
Expert: CodeCruiser replied at 2024-07-22 06:17:57
100 points EXCELLENT
1) Use the Filters property of the dialog. See example at below link
http://msdn.microsoft.com/en-us/library/office/aa210589(v=office.11).aspx
2) VB.NET is different.
Dim fd As New OpenFileDialog
fd.ShowDialog()
3) Because it wants to :-). That is the property to be used to set the initial path as shown in example on below page
http://msdn.microsoft.com/en-us/library/office/aa210656(v=office.11).aspx
http://msdn.microsoft.com/en-us/library/office/aa210589(v=office.11).aspx
2) VB.NET is different.
Dim fd As New OpenFileDialog
fd.ShowDialog()
3) Because it wants to :-). That is the property to be used to set the initial path as shown in example on below page
http://msdn.microsoft.com/en-us/library/office/aa210656(v=office.11).aspx
Author: duncanb7 replied at 2024-07-22 04:29:54
How about the final question 2, similar code for VB.NET ? it seems similar or same, RIght ?
Duncan
Duncan
Expert: gowflow replied at 2024-07-22 04:28:00
I need to logoff now will log in back in 1 to 2 hours. Sorry
gowflow
gowflow
Expert: gowflow replied at 2024-07-22 04:27:14
I do not understand your question. What do you need ?
gowflow
gowflow
Author: duncanb7 replied at 2024-07-22 04:25:14
Sorry for what ?
Expert: gowflow replied at 2024-07-22 04:24:40
Sorry ?
Author: duncanb7 replied at 2024-07-22 04:23:26
Q3 is working at your code
Why you delete code from msoFileDialogFilePicker ?
Why you delete code from msoFileDialogFilePicker ?
Accepted Solution
Expert: gowflow replied at 2024-07-22 04:20:09
400 points EXCELLENT
Oops I can see your code have too many instructions for nothing use this instead:
Sub FileDiag() Dim strFileSelected As String Dim objOfficeDialog As Object Dim wbDestination As Workbook Dim wbSource As Workbook Dim sh As Worksheet Dim res As String Application.DisplayAlerts = False Application.EnableEvents = False Application.ScreenUpdating = False 'Set objOfficeDialog = Application.FileDialog(msoFileDialogFilePicker) Set wbDestination = ActiveWorkbookWith Application.FileDialog(msoFileDialogFilePicker) .InitialFileName = "C:Temp" .Show Application.DisplayAlerts = True Application.EnableEvents = True Application.ScreenUpdating = TrueEnd WithEnd Sub 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:20:21:22:23:24:25:26:
gowflow
Author: duncanb7 replied at 2024-07-22 04:18:59
what is reply at Q1, and q3 is not working
DUncan
DUncan
Expert: gowflow replied at 2024-07-22 04:17:18
for 1)
to see the files
replace in your code this
msoFileDialogFolderPicker
by this
msoFileDialogFilePicker
for 2) not familiar with vb.net
for 3) simply
replace this
"C:Temp*.*"
by this
"C:Temp"
gowflow
to see the files
replace in your code this
msoFileDialogFolderPicker
by this
msoFileDialogFilePicker
for 2) not familiar with vb.net
for 3) simply
replace this
"C:Temp*.*"
by this
"C:Temp"
gowflow