ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Compile Error: Argument not optional (https://www.excelbanter.com/excel-programming/350914-compile-error-argument-not-optional.html)

Brett Smith[_2_]

Compile Error: Argument not optional
 
I am testing something because I am going to be programming the VBE behind
several workbooks. I was testing the following and I got the error
called..Compile Error: Argument not optional. Is there a reason why? Then
it focused on the .Export function.

Sub CopyOneModule()

Dim FName As String

With Workbooks("sirNAsequences7")
FName = .Path & "\code.txt"
.VBProject.VBComponents("Module1").Export
FName
End With
Workbooks("Changemodulecode").VBProject.VBComponen ts.Import
FName

End Sub


Mark Lincoln

Compile Error: Argument not optional
 
I believe FName needs to be in parentheses after Export. Export
requires at minimum a valid filename.



All times are GMT +1. The time now is 02:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com