![]() It is not a problem as anything greater than 0 is what I am looking for. As I only placed one element why does it do this? What still puzzles me is that if I add a single point element into a model, the counter = "2". The purpose was to include this as 'part of' a script to determine whether the User had opened a Seed file. However, I see that Bob has included some much improved code that I will change to. Set oEnumerator = ActiveModelReference.Scan OScanCriteria.IncludeType msdElementTypeLineįor Each oModel In ' Test for any Graphical Elements in the fileĭim oScanCriteria As New ElementScanCriteria Yesterday I had resorted to the following code: LElementTotal = lGraphicElementTotal + lNonGraphicElementTotalĭebug.Print vbNewLine & vbTab & "Total Models: " & lModelTotalĭebug.Print vbTab & "Total Elements: " & lElementTotalĭebug.Print vbTab & vbTab & "NonGraphical Element Count: " & lNonGraphicElementTotalĭebug.Print vbTab & vbTab & "Graphical Element Count: " & lGraphicElementTotal & vbNewLine LNonGraphicElementTotal = lNonGraphicElementTotal + lNonGraphicElementCount LGraphicElementTotal = lGraphicElementTotal + lGraphicElementCount LNonGraphicElementCount = ĭebug.Print vbTab & "Model: " & oModel.name & ", Graphical Elements: " & lGraphicElementCount & ", NonGraphical Elements: " & lNonGraphicElementCount Set oDgn = OpenDesignFileForProgram(sFileSpec, False)ĭim lGraphicElementCount As Long, lGraphicElementTotal As Longĭim lNonGraphicElementCount As Long, lNonGraphicElementTotal As Longĭim lModelTotal As Long, lElementTotal As Longĭebug.Print "Design File: " & oDgn.FullName & ", NonModelCacheCount: " & & vbNewLine Here is a sample:Įnd Sub Sub DgnFileGraphicElementCount(sFileSpec As String) Dim oDgn As DesignFile Sub folders with the HYT customer folder.A way to accomplish this with less overhead would be to query the Graphical and Non Graphical Element caches. WorksheetFunction.Find(" ", fle.Name) + 1) + 4, 2))įle.Copy ParentPath & Left(fle.Name, 3) & _ WorksheetFunction.Find(" ", fle.Name) + 1) + 4, 2))) Thenįso.CreateFolder ParentPath & Left(fle.Name, 3) & "\" & _ If Not fso.FolderExists(ParentPath & Left(fle.Name, 3) & "\" & _ ![]() 'folder for the month that the file relates to 'Check to see if there is subfolder within the company 'based on the initials of the customer nameįso.CreateFolder ParentPath & Left(fle.Name, 3) If Not fso.FolderExists(ParentPath & Left(fle.Name, 3)) Then 'for the customer that the file relates to Set AllFilesFolder = fso.GetFolder(AllFilesFolderPath) 'Store the all files folder's path in a variableĪllFilesFolderPath = "C:\Users\chest\Desktop\All Files" We want a folder for each customer: HYT and XYZ and within the customer folder we want a subfolder for the month that each file relates to. In this example we want to organise files based on file name. If Not fso.FolderExists(ParentPath & fle.Type) Thenįle.Copy ParentPath & fle.Type & "\" & fle.Name 'If a folder for the file type does not exist. 'Loop through the collection of files in the old folder 'Store the path for the new folders in a variable 'Store the old folder's path in a variable Once email/attachment is saved to its location the file details are appended to the columns on the next row in the selected Excel file. In the Save Email/Attachment window, navigate to project folder and select subfolder. In this example we create a folder for each file type of files found in MyFolder and then copy the files to the appropriate folder. User selects No - go to step three to save email/attachment without registering details. If Left(fso.GetExtensionName(fle.Path), 2) = "xl" Thenįle.Copy ExcelFolderPath & "\" & fle.NameĬontents of All Excel Files folder (once code executed) shown below. Set MyFolder = fso.GetFolder(MyFolderPath)ĮxcelFolderPath = fso.CreateFolder(ParentPath & "All Excel Files").Path MyFolderPath = "C:\Users\chest\Desktop\MyFolder" In this example the Type property of the File object is used to determine whether a file gets copied. Source:=MyPath & "MyFolder\Move Me.xlsx", _ĭestination:=MyPath & "FolderXYZ\Move Me.xlsx"Įnd Sub Practical Examples Copy Files With a Specific File Type If fso.FileExists(MyPath & "MyFolder\Move Me.xlsx") Then The FileExists method has a single parameter: FileSpec Sub CheckIfFileExists() If fso.FolderExists(MyPath & "\MyFolder") Then
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |